I can't found trip results in skyscanner REST API

197 Views Asked by At

I obtain this error: 403,\n "message" : "Missing base pricing access for session creation when I try to obtain this requests in Python with Skyscanner REST API. Other requests are resolved correctly

  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)
1

There are 1 best solutions below

0
dephekt On

An HTTP 403 error is typically used to indicate a lack of permissions. The error message you received "Missing base pricing access for session creation" seems to also point to inadequate permissions. The list of response codes here also supports a lack of access: https://skyscanner.github.io/slate/#response-codes

403 Forbidden -- The API Key was not supplied, or it was invalid, or it is not authorized to access the service.

I would try running the request through curl or a tool like Postman to confirm it's your API key and not your code. Then check with the API provider to determine why you don't have access to that endpoint.