首页 > 解决方案 > 我正在尝试为股票代码“AAPL”构建数据字典但是我遇到了这个错误消息 HTTPError:HTTP 错误 400:

问题描述

这是函数 apple_dict=f.build_dict('AAPL')

这是主脚本

def profile_data_(self,symbol): """ 从 API 中提取给定股票代码的指标数据

    Parameters
    ----------
    symbol : A ticker symbol (str) e.g. 'MSFT','FB','AAPL', or 'TWTR'

    Returns
    -------
    None. Updates the self.profile with the data. 
    """        
    if not self.key_registered:
        print("API key not registered yet.")
        return None
    
    url = "https://financialmodelingprep.com/api/v3/"+'?apikey='+self.key
    response = urlopen(url)
    data = response.read().decode("utf-8")
    self.profile = json.loads(data)
    return json.loads(data)

标签: apirepositoryclone

解决方案


推荐阅读