This project involved learning how to use the urllib and requests Python
libraries to send and receive HTTP messages to URL's. I practiced sending GET
and POST requests, fetching JSON resources, and interacting with API's (the
Star Wars API, GitHub API, and Twitter API).
-
0. What's my status? #0
- 0-hbtn_status.py: Python script that fetches
https://intranet.hbtn.io/status. - Uses
urllib.
- 0-hbtn_status.py: Python script that fetches
-
1. Response header value #0
- 1-hbtn_header.py: Python script that displays the
X-Request-Idresponse header variable of a request to a given URL. - Usage:
./1-hbtn_header.py <URL>- Uses
urllib.
- Uses
- 1-hbtn_header.py: Python script that displays the
-
2. POST an email #0
- 2-post_email.py: Python script that sends a
POSTrequest to a given URL with a given email, and displays the response body. - Usage:
./2-post_email.py <URL> <email>.- Uses
urllib.
- Uses
- 2-post_email.py: Python script that sends a
-
3. Error code #0
- 3-error_code.py: Python script sends a request to a given URL and displays the response body.
- Handles HTTP errors.
- Uses
urllib.
- Uses
-
4. What's my status? #1
- 4-hbtn_status.py: Python script that fetches
https://intranet.hbtn.io/status. - Uses
requests.
- 4-hbtn_status.py: Python script that fetches
-
5. Response header value #1
- 5-hbtn_header.py: Python script that displays the
X-Request-Idresponse header variable of a request to a given URL. - Usage:
./5-hbtn_header.py <URL>- Uses
requests.
- Uses
- 5-hbtn_header.py: Python script that displays the
-
6. POST an email #1
- 6-post_email.py: Python script that sends a
POSTrequest to a given URL with a given email, and displays the response body. - Usage:
./6-post_email.py <URL> <email>.- Uses
requests.
- Uses
- 6-post_email.py: Python script that sends a
-
7. Error code #1
- 7-error_code.py: Python script sends a request to a given URL and displays the response body.
- Handles HTTP errors.
- Uses
requests.
- Uses
-
8. Search API
- 8-json_api.py: Python script that sends a
POSTrequest tohttp://0.0.0.0:5000/search_userwith a letter passed as parameter. - Usage:
./8-json_api.py <letter>- The letter is sent as the value of the variable
q. - If no letter is given, sets
q="". - If the response body is properly formatted and non-empty, displays it as
[<id>] <name>.
- The letter is sent as the value of the variable
- Uses
requests.
- 8-json_api.py: Python script that sends a
-
9. Star Wars API #0
- 9-starwars.py: Python script sends a search request to
the Star Wars API
peopleendpoint with a given string. - Usage:
./9-starwars.py <search string>- Displays the total number and
nameof each result. - Uses
requests.
- Displays the total number and
- 9-starwars.py: Python script sends a search request to
the Star Wars API
-
10. My Github!
- 10-my_github.py: Python script that takes GitHub credentials (username and password) and uses the Github API to display the corresponding ID.
- Usage:
./10-my_github.py <username> <password>- Uses
requests.
- Uses
-
11. Time for an interview!
- 100-github_commits.py: Python script that lists the 10 most recent comments of a given GitHub repository using the GitHub API.
- Usage:
./100-github_commits.py <repository name> <owner name>- Uses
requests.
- Uses
-
12. Star Wars API #1
- 101-starwars.py: Python script that sends a search
request to the Star Wars API
peopleendpoint with a given string. - Usage:
./101-starwars.py <search string>- Displays the total number and
nameof each result. - Manages pagination to display all results.
- Uses
requests.
- Displays the total number and
- 101-starwars.py: Python script that sends a search
request to the Star Wars API
-
13. Star Wars API #2
- 102-starwars.py: Python script that sends a search
request to the Star Wars API
peopleendpoint with a given string. - Usage:
./102-starwars.py <search string>- Displays the total number and
nameof each result as well as the list of films associated with each character. - Manages pagination to display all results.
- Uses
requests.
- Displays the total number and
- 102-starwars.py: Python script that sends a search
request to the Star Wars API
-
14. Twitter Auth
- 103-search_twitter.py: Python script that sends
a search request to the Twitter API
searchendpoint with a given string. - Usage:
./103-search_twitter.py <consumer key> <consumer secret> <search string>- Displays the the top 5 results in the format
[<Tweet ID>] <Tweet text> by <Tweet owner name>.
- Displays the the top 5 results in the format
- Uses
requests.
- 103-search_twitter.py: Python script that sends
a search request to the Twitter API