|
| 1 | +# It's time to solve the riddle |
| 2 | + |
| 3 | +## Tools we need before starting |
| 4 | + |
| 5 | +### Install pip |
| 6 | +``` |
| 7 | +$python3 -m ensurepip |
| 8 | +``` |
| 9 | + |
| 10 | +### Create a virtualenv and activate it |
| 11 | +``` |
| 12 | +$ python3 -m venv fossmeet |
| 13 | +$ source fossmeet/bin/activate |
| 14 | +``` |
| 15 | + |
| 16 | +### Install requests python module |
| 17 | +``` |
| 18 | +$ python3 -m pip install requests |
| 19 | +``` |
| 20 | + |
| 21 | +## It's time to follow next steps |
| 22 | + |
| 23 | +Here is the github contributions API url |
| 24 | +https://api.github.com/repos/python/cpython/stats/contributors |
| 25 | + |
| 26 | +[1.] Create a github token to access github API by following this |
| 27 | + link: https://github.com/settings/tokens/new |
| 28 | + |
| 29 | +[2.] Copy the token store it safely in a file |
| 30 | + |
| 31 | +[3.] Create a file name github_repo_contributors.py |
| 32 | + |
| 33 | +[4.] Create first function which will ask for your github |
| 34 | + username and token and return it as a tuple. |
| 35 | + |
| 36 | +[5.] Import requests module, then use *requests.get* method to |
| 37 | + call the github API and then store the response |
| 38 | + * check the response status code if it is not 200 |
| 39 | + then raise exception with proper message. |
| 40 | + * If you get the response code == 200 then use json module |
| 41 | + and dump response data in contribution.json |
| 42 | + |
| 43 | +[6.] Since we have data now, create another function which will |
| 44 | + return contributors name and their contributions |
| 45 | + |
| 46 | +[7.] Procced with first top 10 contributors name |
| 47 | + |
| 48 | +[8.] Print the no. of contributors with same commit. |
0 commit comments