#100DaysOfCode in Python Transcripts
Chapter: Days 61-63: Using the Github API with Python
Lecture: Quick detour: getting help in Python
0:00 Let's look quickly how you can get help in Python.
0:03 And some time ago we did an article
0:06 describing the main functions you can use.
0:09 So we have help, dir, combining them, pydoc.
0:13 So let's see if we can use pydoc on the Github module.
0:17 And to use an outside command in you Jupyter notebook
0:20 you can use the ! or exclamation mark
0:23 followed by the command.
0:29 Right, I thought I mistyped a module,
0:31 but doing it on the package and on the module name,
0:34 the importer there is no Python documentation found.
0:39 But not to worry, you can just use help on an object.
0:43 For example, we just created pb, the get_user PyBites
0:47 and I can now type help on pb, and look at that.
0:53 It's a named user and it shows the class
0:55 and the methods and even the URL to the Github API.
1:00 So in the next example we want to see
1:02 the get_repos in action.
1:05 So I can just go to get_repos,
1:09 see what it receives, see what it returns.
1:12 And see the endpoint in the API.
1:21 That's pretty useful.
1:23 And another command is dir,
1:25 you can use it like that, and here we see all the
1:28 attributes on that object.
1:31 So you see the dunder methods,
1:32 the internal methods and the public interface.
1:36 And now I know I can for example, get followers.
1:42 How cool is that!
1:44 Later we will see git gists, and look at how
1:47 huge the API is, how many methods
1:50 and attributes an object has.
1:52 You can get a lot of data out of it.
1:55 We can also just call help on a method like this.
1:58 So we already saw this one before
2:00 but instead of scrolling through the whole object or class
2:04 we can just look at a single method.
2:07 And that's all there is to the basics.
2:10 I use this heavily when I was working with the API
2:13 and let's look at a practical example next.