Python 我能';在skyscanner REST API中未找到trip结果
我获得以下错误:403,\n“消息”:“当我尝试使用Skyscanner REST API在Python中获取此请求时,缺少会话创建的基本定价访问权限。其他请求已正确解析Python 我能';在skyscanner REST API中未找到trip结果,python,rest,python-requests,api-key,skyscanner,Python,Rest,Python Requests,Api Key,Skyscanner,我获得以下错误:403,\n“消息”:“当我尝试使用Skyscanner REST API在Python中获取此请求时,缺少会话创建的基本定价访问权限。其他请求已正确解析 data = { 'cabinclass': 'Economy', 'country': 'ES', 'currency': 'EUR', 'locale': 'es-ES', 'locationSchema': 'iata', 'originplace': '{origin}'.format(or
data = {
'cabinclass': 'Economy',
'country': 'ES',
'currency': 'EUR',
'locale': 'es-ES',
'locationSchema': 'iata',
'originplace': '{origin}'.format(origin=originplace),
'destinationplace': '{destination}'.format(destination=destinationplace),
'outbounddate': '{y}-{m}-{d}'.format(y=str(date.year),m=str(date.month).zfill(2),d=str(date.day).zfill(2)),
'inbounddate':'',
'adults': '{numadul}'.format(numadul=nadults),
'children': '{numchildren}'.format(numchildren=nchildren),
'infants': '{numinfants}'.format(numinfants=ninfants),
'apikey': 'myapiKey'
}
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
response=requests.post('https://partners.api.skyscanner.net/apiservices/pricing/v1.0',headers=headers, data=data)
HTTP 403错误通常用于表示缺少权限。您收到的错误消息“缺少会话创建的基本定价访问权限”似乎也表明权限不足。此处的响应代码列表也支持缺少访问权限: 403禁止--未提供API密钥,或者该密钥无效,或者未授权访问该服务
我会尝试通过curl或类似Postman的工具运行请求,以确认它是您的API密钥,而不是您的代码。然后与API提供商联系,确定您无法访问该端点的原因。我正在使用以下数据:{'cabinclass':'Economy','country':'ES','currency':'EUR','locale':'ES','locationSchema':'iata','originplace':'MAD sky','destinationplace':'BCN sky','outbounddate':'2021-04-30','inbounddate':'1','children':'0','bairs':'0','apikey':'myapikey'}