
Accessing Application Programming Interfaces (API)s
listContents
wb_incandescentResources
live_helpGuiding questions
- How can we leverage the power of a remote database system programatically in python?
check_circleLearning Objectives
- Use the requests library and supporting modules to request information from an API
- Parse data returned from an API into useful products for our own purposes
bookResources
- Api directory at Programmable Web
- aprequest.io for request building
- Another web-based api tester with plenty of nice documentation and low ad count
- Donors choose main site whose servers also host an API which our sample program interacts with
- Donors Choose API Documentation
- Sample script for asking DonorsChoose for search results
- The urllib package for python 3 provides a suite of tools for fetching URL data. I believe it uses the Requests library in the back end.
- Requests library (http for humans)
- National Highway Traffic Safety Administration API list (Great!--no key required)
- NHTSA longer example from Fall 2020 class session
- Finacial Modeling Prep API (Easy to get Key and test)
- NHTSA API call sample python code (very simple)
- RFC 2616: HTTP standard specification, heavy reading, nice to know about
- Advanced use of requests library for API retries
API Tracker
When you have decided on an API, please make an entry in our tracker spreadsheet
listLesson sequence
- Discuss course plan: project design for course
- API Fundamentals: Donors Choose API and sample tweaking according to the specification below
- API Design project and worktime
Security Notes
API keys are generally considered restricted data that shouldn't shared on a public-facing repository. Keeping your API key secure can be done in a few ways:
File-storage with .gitignore
- Create a text file containing only your API key and store that file in a dedicated directory in your project structure, with names as stealthy as you want
- Tell git using the .gitignore file to never track files inside your dedicated security directory by creating a an entry in the .gitignore to match your security directory name
- Write a short code snippet which loads the file from your security directory and includes the value of your sensitive key in a variable which stays only in ram, and is not pushed to public git.


program objective |
Use data from an API service to answer one or more compelling inquiry questions of your design |
program requirement 1 |
Engineer a python script that uses the requests library to make calls to an API of your choosing. Assemble data that is returned from that API to answer the question or set of questions you designed for this project. |
program requirement 2 |
Once you have data assembled that speaks to your research question, format the results of your API inquiry in a format that is understandable by a non-pythonista and can be posted on our course website and on the walls of our classroom 1136! Graphs, charts, figures, tables, images--all of these are welcome and invited. |
playlist_add_checkMid-week ToDOs
Complete your API project and upload it to your github account.
arrow_upwardback to schedule