#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.
0:02 First, we did some setup.
0:06 We had to create a virtual environment
0:08 and pip install pygithub.
0:11 Then, we looked at how you can create a Github object
0:14 to interface with the API.
0:19 Use the get_user method to get info off our PyBites user
0:24 and we've seen that you can use help
0:27 to inspect that object
0:29 to see all the methods and attributes available.
0:34 The same with there.
0:37 And even more interesting, you can use pdb
0:39 to live inspect your code as it is running.
0:42 That was very useful for me working with this module.
0:45 Then we wrote a script
0:46 to get the most popular repos of PyBites.
0:51 We use the get_repos method of the API
0:53 and saw how you can use lambda to sort on an attribute,
0:57 in this case, stars, of the namedtuple
1:00 to get the most popular repo at the top.
1:05 Which lead to this output
1:06 and the Github API offers a ton of data.
1:09 And lastly, we did a post request
1:11 to the API by creating a gist.
1:15 We created an access token and we saw how you can load it
1:18 into your script via the os.environ method.
1:23 We made a Github object with the token
1:26 and saw that the rate limiting increased.
1:29 So you can make more calls to the API
1:30 when you're authenticated.
1:33 Then we used to create_gist method
1:36 to get all of the input file content
1:38 to post code to the Github API.
1:40 So we had some code, which was actually a script we wrote,
1:44 and we used the method saying public True, script name,
1:48 code, wrapped into the input file content method,
1:52 and a description.
1:53 Look at that.
1:54 That created a gist on Github.
1:58 And now it's your turn.
1:59 Keep calm and code in Python.