0

I am very new to Python (and relatively new to programming) and would appreciate any help.

How would I use the following example link to download the supplied information using Python.

https://url.com/InfoService/GetFlightByFlightNum?board={BOARD}&flightNum={FLIGHTNUM}

Method: GET

Thanks

2 Answers 2

1

The most easy way to access APIs from python is using the requests library

You can quickly install it with pip install requests

Then you can do that for your example:

import requests

payload = {'board': {BOARD}, 'flightNum': {FLIGHTNUM}}
r = requests.get('https://url.com/InfoService/GetFlightByFlightNum', params=payload)

# print the response result
print r.text
Sign up to request clarification or add additional context in comments.

Comments

0

You can use the builtin library urllib2.

Python 2 documentation: http://docs.python.org/2/library/urllib2.html

Python 3 documentation: http://docs.python.org/3.1/howto/urllib2.html

Here are some examples: How do I download a file over HTTP using Python?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.