Setup: GitHub Public API Application using Python (Part-1)

Have you ever thought of making a complete Python application of any API but do not know how to start? Well, you are in the right place. In three part tutorials, I am going to show you how to make GitHub API application using Python. This tutorial is about making the field to work. We are going to do some necessary tasks in order to play with GitHub API in depth. So without further ado, let’s get started!

The very first thing that we would require is to install Python in our system. If you already have Python installed in your computer, you should go down below where I discussed “library that you need to install,” section in order to use GitHub API. If you do not have Python installed, then let’s do it.

Installing Python

The very first thing that you need is to go to the following link in order to install Python:

I am going to download Python 3.6.4. In case you find the latest version of the Python while reading this tutorial, then I would highly recommend you to get the latest version of it.

Once you are done downloaded Python, the next step is installation. The installation of Python is pretty straightforward. All you need is to follow the steps and press few “Next” buttons.

Using pip3 in CMD(command prompt)

The next thing we need is to use pip3 in command prompt. PIP stands for “Pip install Packages.” Well, we need to install a package for GitHub API. Therefore, it is necessary to have a working pip3 feature of python. In order to use pip, first go the Search Windows, and type %AppData% as shown below:

Once you typed %AppData% you will get the folder named “AppData.” Click on it!

There you would find few folders, but the one in which we are interested in is the folder named “Local.” Open it(as shown below)!

Then go to Programs -> Python -> Python3.6 -> Scripts. There you would see pip3.exe. Now copy the Path from above. Like:

Now you need to type in the Search Window “Environment Variables” and click the option shown below:

Once you click on it, you would be provided with the following window:

Click on the “Environment Variables” button! Now in “the System Variables”, you need to find the entry named “Path.” Select the “Path” entry, and hit Edit. Now click on “New” and paste the link that you have copied before. Click Ok! And close the window!

That’s it for the tedious, installation part.

Now the fun begins!

We now need to download and install the library that we would use to get the JSON data from GitHub API. Let’s find out how we can do it!

Library that you need to install

In order to get the JSON data, we would require the “requests” library for Python. Type CMD in the “Search Windows” text-field and open Command Prompt. Once you open the Command Prompt, type the following command:

pip3 install requests

and hit Enter!

Once the installation is done, we are ready to code Python application for GitHub.

Wrap Up

In the next two parts, I am going to first discuss the mechanics of the GitHub API and then we will make the complete application using Python.
See you in the next part!

Next Part

In-depth: GitHub Public API Structure and Fields (Part-2)

Related article



Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?