List 如何在Python中使用API键执行API请求
所以我一直在尝试访问这个API,但我需要使用API密钥来访问它。我有一个API密钥,但我不确定如何格式化所有内容并传输url。我的url看起来像这样-- 我使用的sit也会留下以下信息:List 如何在Python中使用API键执行API请求,list,api,dictionary,key,screen-scraping,List,Api,Dictionary,Key,Screen Scraping,所以我一直在尝试访问这个API,但我需要使用API密钥来访问它。我有一个API密钥,但我不确定如何格式化所有内容并传输url。我的url看起来像这样-- 我使用的sit也会留下以下信息: This is the documentation for SportsDataIO's NFL API. All of our API endpoints can be accessed via an HTTP GET request using your API key. The API key can b
This is the documentation for SportsDataIO's NFL API. All of our API endpoints can be accessed via an HTTP GET request using your API key. The API key can be passed either as a query parameter or using the following HTTP request header.
Ocp-Apim-Subscription-Key: {key}
我不知道这意味着什么,我对数据抓取是相当陌生的
如果有人能提供帮助,那就太好了,谢谢。意味着您需要通过标题传递api密钥:
import requests
api_key = 'put your api key here'
url = 'https://api.sportsdata.io/v3/nfl/scores/json/Players'
headers = {'Ocp-Apim-Subscription-Key': '{key}'.format(key=api_key)}
jsonData = requests.get(url, headers=headers).json()
你在用python吗?是的,我在用python