amadeus4dev / amadeus-code-examples

Self-contained examples for Amadeus REST APIs
MIT License
83 stars 39 forks source link

Keep getting ServerError 500 when trying the examples #47

Closed robsannaa closed 1 year ago

robsannaa commented 2 years ago

Hello! I am trying to run the code example from the python SDK, but every time I try to get a response I get a 500 error. I have the access token and the token secret, and it seems that the client is instantiated correctly, however, I cannot understand why do I get this error.

from amadeus import Client, ResponseError

amadeus = Client(
    client_id=client_id,
    client_secret=client_secret
)

response = amadeus.shopping.flight_dates.get(origin='BGY', destination='KRK')
print(response.data)
ServerError                               Traceback (most recent call last)
Input In [34], in <cell line: 10>()
      2 from amadeus import Client, ResponseError
      4 amadeus = Client(
      5     client_id=client_id,
      6     client_secret=client_secret
      7 )
---> 10 response = amadeus.shopping.flight_dates.get(origin='BGY', destination='KRK')
     11 print(response.data)

File ~\Miniconda3\lib\site-packages\amadeus\shopping\_flight_dates.py:22, in FlightDates.get(self, **params)
      5 def get(self, **params):
      6     '''
      7     Find the cheapest flight dates from an origin to a destination.
      8 
   (...)
     20     :raises amadeus.ResponseError: if the request could not be completed
     21     '''
---> 22     return self.client.get('/v1/shopping/flight-dates', **params)

File ~\Miniconda3\lib\site-packages\amadeus\mixins\http.py:40, in HTTP.get(self, path, **params)
     19 def get(self, path, **params):
     20     '''
     21     A helper function for making generic GET requests calls. It is used by
     22     every namespaced API GET method.
   (...)
     38     :raises amadeus.ResponseError: when the request fails
     39     '''
---> 40     return self.request('GET', path, params)

File ~\Miniconda3\lib\site-packages\amadeus\mixins\http.py:110, in HTTP.request(self, verb, path, params)
     88 def request(self, verb, path, params):
     89     '''
     90     A helper function for making generic POST requests calls. It is used by
     91     every namespaced API method. It can be used to make any generic API
   (...)
    108     :raises amadeus.ResponseError: when the request fails
    109     '''
--> 110     return self._unauthenticated_request(
    111         verb, path, params,
    112         self.__access_token()._bearer_token()
    113     )

File ~\Miniconda3\lib\site-packages\amadeus\mixins\http.py:126, in HTTP._unauthenticated_request(self, verb, path, params, bearer_token)
    124 request = self.__build_request(verb, path, params, bearer_token)
    125 self.__log(request)
--> 126 return self.__execute(request)

File ~\Miniconda3\lib\site-packages\amadeus\mixins\http.py:152, in HTTP.__execute(self, request)
    150 response = Response(http_response, request)._parse(self)
    151 self.__log(response)
--> 152 response._detect_error(self)
    153 return response

File ~\Miniconda3\lib\site-packages\amadeus\mixins\parser.py:16, in Parser._detect_error(self, client)
     14 error = self.error_for(self.status_code, self.parsed)
     15 if error is not None:
---> 16     self.__raise_error(error, client)

File ~\Miniconda3\lib\site-packages\amadeus\mixins\parser.py:67, in Parser.__raise_error(self, error_class, client)
     65 error = error_class(self)
     66 error._log(client)
---> 67 raise error

ServerError: [500]
tsolakoua commented 1 year ago

The API is test environment is not working properly and the development team is working on a fix. Since the issue is not related to the SDK itself, but the API behind it I close it.