#100DaysOfCode in Python Transcripts
Chapter: Days 61-63: Using the Github API with Python
Lecture: Concepts: what did we learn

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's review what we've learned so far. First, we did some setup. We had to create a virtual environment and pip install pygithub.
0:12 Then, we looked at how you can create a Github object to interface with the API. Use the get_user method to get info off our PyBites user
0:25 and we've seen that you can use help to inspect that object to see all the methods and attributes available. The same with there.
0:38 And even more interesting, you can use pdb to live inspect your code as it is running. That was very useful for me working with this module.
0:46 Then we wrote a script to get the most popular repos of PyBites. We use the get_repos method of the API
0:54 and saw how you can use lambda to sort on an attribute, in this case, stars, of the namedtuple to get the most popular repo at the top.
1:06 Which lead to this output and the Github API offers a ton of data. And lastly, we did a post request to the API by creating a gist.
1:16 We created an access token and we saw how you can load it into your script via the os.environ method. We made a Github object with the token
1:27 and saw that the rate limiting increased. So you can make more calls to the API when you're authenticated. Then we used to create_gist method
1:37 to get all of the input file content to post code to the Github API. So we had some code, which was actually a script we wrote,
1:45 and we used the method saying public True, script name, code, wrapped into the input file content method, and a description. Look at that.
1:55 That created a gist on Github. And now it's your turn. Keep calm and code in Python.

Talk Python's Mastodon Michael Kennedy's Mastodon