10.3.4 获取股票信息
编写文件yahoo_finance.py,功能是通过Yahoo Finance网站获取股票的价格信息,以供后续的分析和处理使用。
packet_stream_proxy = "http://easymap_buyer:34Qgo0O03zOhrx8h@proxy.packetstream.io:31112"
bright_data_proxy = 'http://brd-customer-hl_f8b1a708-zone-finance:u7iz73qdf9wv@brd.superproxy.io:22225'
proxy = bright_data_proxy
def request_yahoo_url(url):
hed = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',