Sports Management

A huge list of more than 20 thousand APIs – you should have no trouble finding one you have some interest in!
http://www.programmableweb.com/category/all/apis
Here are some fun ones:
Art: https://metmuseum.github.io/
Sports: https://developer.sportradar.com/, https://probasketballapi.com/
Weather: https://openweathermap.org/api
Beer: http://www.brewerydb.com/developers
Nutrition: https://www.nutritionix.com/business/api and https://ndb.nal.usda.gov/api-guide.html
Reddit: https://www.reddit.com/dev/api/
Youtube: https://developers.google.com/youtube/
Marvel Comics: https://developer.marvel.com/
Money: https://github.com/Live-Rates/live-rates.com
Or any other data API you can find on the internet.
Task
The task is to use the requests package (do not use possibly existing specific python packages for the API) to:
interact with the API
create a dataset with multiple records by requesting data from the API using the requests package
write a simple API client, i.e. a function that would make downloading/interacting with the API simple for a Python user who does not
know requests

  1. Choose an API
    a) Choose an API and briefly describe the type of data you can obtain from it. Note: Please do not use any of the APIs we covered in lecture
    (e.g. NYTimes, Github etc.).
    b) Provide a link to the API documentation and
    c) the base URL of the API you intend to use.
  2. Authentication
    a) Briefly explain how the API authenticates the user. b) Apply for an API key if necessary and provide the information (with relevant URL)
    how that can be done. Do not include the API key in the assignment submission.
  3. Send a Simple GET request
    a) Execute a simple GET request to obtain a small amount of data from the API. Describe a few query parameters and add them to the
    query. If you have a choice of the output the API returns (e.g. XML or JSON), I suggest to choose JSON because it easier to work with. Your
    output here should include the code for the GET request, including the query parameters, as well as a snippet of the output.
    b) Check (and show) the status of the request.
    c) Check (and show) the type of the response (e.g. XML, JSON, csv).
  4. Parse the response and Create a dataset
    a) Take the response returned by the API and turn it into a useful Python object (e.g. a list, vector, or pandas data frame). Show the code
    how this is done.
    b) Using the API, create a dataset (in data frame format) for multiple records. I’d say a sample size greater than 100 is sufficient for the
    example but feel free to get more data if you feel ambitious and the API allows you to do that fairly easily. The dataset can include only a
    small subset of the returned data. Just choose some interesting features. There is no need to be inclusive here.
    c) Provide some summary statistics of the data. Include the data frame in a .csv file called data.csv with your submission for the grader.

This question has been answered.

Get Answer