#100DaysOfCode in Python Transcripts
Chapter: Days 61-63: Using the Github API with Python
Lecture: Setup and creating a Github user object

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, let's get started.
0:03 First, we need to pip install pygithub,
0:06 which is the module we are going to use
0:08 to query the API and post to it.
0:12 So, let's head over to my terminal,
0:14 and create a virtual environment.
0:18 Let's create a directory, CD into it,
0:22 and, as explained in other videos, I have an alias
0:26 to create virtual environments based on my use of Anaconda.
0:30 So I found a virtual env with the path
0:34 pointing to my Python binary in Anaconda,
0:37 that's the best way for me to do it,
0:39 but as you've probably seen in other videos,
0:42 another way to do it is Python -m
0:46 venv, and the name of your venv,
0:48 which I usually call venv by convention.
0:51 That's totally cool as well.
0:54 But I'm going to go with my setup.
0:59 Then you have to enable the virtual environment.
1:02 So, I'm doing that often because I use virtual environments
1:05 for every project I work on, I have an alias.
1:09 So, I can just type ae, and I'm in.
1:13 So as you see we are starting from a clean slate,
1:16 and I'm going to do pip install pygithub.
1:31 So with that done, head over to the notebook,
1:33 and note that I have the virtual environment enabled.
1:38 Here's how you can do that.
1:42 You need to pip install ipykernel,
1:45 and then there's a command that you can
1:47 set your virtual environment inside the notebook.
1:52 That's why you see me using venv here,
1:55 and having access to pygithub.
1:57 So, let's import the modules we are going to use.
2:03 And it's a bit inconsistent,
2:04 so the package is called pyGitHub, camel-cased,
2:07 but you actually use it as github lowercased.
2:12 Now, let's make a Github object.
2:23 And now I can work with that object.
2:25 Notice that we didn't log in, so we're a bit limited
2:28 in the amount of calls we can make to the API at this point.
2:38 And you will see later that
2:39 when we make this object with a token,
2:41 we can make many more calls to the API.
2:44 And let's work with our PyBites user.
2:51 So, I'm going to store the user in pb.
3:01 And there you go, and before retrieving data from the API,
3:05 let's take a little bit of a detour
3:08 to show you the help functions in Python.
3:10 And that's because I've found the documentation
3:13 not very complete and helpful for this module,
3:16 so, when I worked with this module
3:19 for a co-challenged platform, I used help and there
3:22 to inspect the module and see what was available for use.
3:26 So that's why I want to give you those tips as well.