Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

carhire_service.get_result(...) Missing data #28

Open
davidch413 opened this issue Apr 11, 2017 · 1 comment
Open

carhire_service.get_result(...) Missing data #28

davidch413 opened this issue Apr 11, 2017 · 1 comment

Comments

@davidch413
Copy link

davidch413 commented Apr 11, 2017

I have reused the example from the documentation but every time I make a request I receive a response without submitted_query, images and car_classes lists. I'm using python 3.4.6

`from skyscanner.skyscanner import CarHire

carhire_service = CarHire('my_api_key')

result = carhire_service.get_result(
market='UK',
currency='GBP',
locale='en-GB',
pickupplace='27544008',
dropoffplace='27544008',
pickupdatetime='2017-04-18T10:00',
dropoffdatetime='2017-04-25T10:00',
driverage='21',
userip='127.0.0.1').parsed

print(result)
`

@davidch413 davidch413 changed the title carhire_service.get_results(...) Missing data carhire_service.get_result(...) Missing data Apr 11, 2017
@davidch413
Copy link
Author

davidch413 commented Apr 24, 2017

I found out what the issue is. The documentation says:

... supplying &deltaExcludeWebsites= removes all images, the query, and the car classes lookup. The Location header in the first poll will include this parameter, even if it’s an empty string, in order that you don’t fetch that information multiple times.

To fix it, I have overwritten the create_session method and added

poll_path = poll_path.split('&deltaExcludeWebsites', 1)[0]

This removes &deltaExcludeWebsites from the poll_path allowing images, car classes and query to be returned.

A better way would be saving the data from initial request and merging it with data from the final poll. I will try that approach once I have some spare time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant