Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Consuming JSON APIs

We are going to introduce the concept for HTTP clients by using the famous requests Python library.

Your job is to consume 2 APIs:

Write a Python program that produces the following histogram: country_name: # of airports in it.

Save that histogram to a JSON file.

It should look something like this:

{
  "Moldova": 5,
  "USA": 555,
  ...
}

Extra Credit

Using the simple_http_server.py and SQLAlchemy, make a Flask server that can answer the following question: How many airlines are there in a country?

The server should answer with the following routes:

GET /airlines?country=Bulgaria
GET /airlines?country_code=BG

Some steps that can help you structure your program:

  1. Make models in SQLAlchemy
  2. Import the JSON data into SQL database via that models
  3. Implement a Flask serve with that models & database
  4. Make the /airlines route answer the question.