amadeus4dev / amadeus-python

Python library for the Amadeus Self-Service travel APIs
https://developers.amadeus.com
MIT License
201 stars 80 forks source link

Query parameter 'scheduledDepartureDate' should not be past date #207

Closed alexmellott closed 10 months ago

alexmellott commented 10 months ago

Description

Using the Production endpoint and a Python code sample, unable to return same-day flight information and receive the following error: [scheduledDepartureDate] Query parameter 'scheduledDepartureDate' should not be past date

Steps to Reproduce

Sample Python code:

from amadeus import Client, ResponseError

amadeus = Client(
    client_id='<INSERT>',
    client_secret='<INSERT>',
    hostname='production'
)

try:
    '''
    Returns flight status of a given flight
    '''
    response = amadeus.schedule.flights.get(carrierCode='UA',
                                            flightNumber='1980',
                                            scheduledDepartureDate='2023-12-29')
    print(response.data)
except ResponseError as error:
    raise error

Versions

Python3.11.5 MacOS 13.2.1

siddydutta commented 10 months ago

Perhaps a timezone issue? From this Stack Overflow post:

the date & time of returning from Flight APIs in Amadeus Self-Service APIs are based on the local date & time, not the UTC date.

tsolakoua commented 10 months ago

Thanks @siddydutta for the answer.

For future questions that are not related to the libraries, but are related to the API itself, get in touch with the dedicated support channel.