我一直在使用Romel Torres的alpha-vantage包,但也希望直接使用来自python的alpha-vantage API(提供更强大的功能)来处理包请求,如下所述CALL with CURL an API through Python:import requests
import alpha_vantage
API_URL = "https://www.alphavantage.co/query"
data = {
"function": "TIME_SERIES_DAILY",
"symbol": "NIFTY",
"outputsize": "compact",
"datatype": "csv"
"apikey": "XXX",
}
response = requests.get(API_URL, data)
print(response.json())[/code]
但是我在返回的dict中得到了以下错误消息:{'Error Message': 'Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.'}
对于requests.post(),结果是:response = requests.post(API_URL, data)
{'detail': 'Method "POST" not allowed.'}
我已经重新检查了文档,并遵循所有必需的API参数。感谢您对我可能遗漏的内容以及正确的呼叫和/或任何其他替代方法的帮助。谢谢