Question
This assignment will require that write a code to interface with external REST-based APIs. for this assignment chose GitHub because many of its APIs are
This assignment will require that write a code to interface with external REST-based APIs. for this assignment chose GitHub because many of its APIs are public and do not require any authorization or API Keys. This simplifies both the use and setup.
For this assignment imagine that a person have been asked to develop a function that will interface with GitHub in order to extract and present useful information to your user. The function will communicate using the RESTful services APIs provided by GitHub. The GitHub APIs will allow to query for information about users, repositories, etc... which can be retrieved using the function, and then be displayed in the application.
What should make this assignment different from other programming assignments is in how you will approach it. approach this assignment as a developer who more than anything else has the perspective of the tester in the front of mind.
The developer looks at the requirements and asks how should I design and implement this function, but the tester will ask questions such as what will I need to test for in this function? And how will I test this function? As design and write the function as a developer, consider the perspective of the tester in any of design and implementation decisions.
Requirements:
write a function that will take as input a GitHub user ID. The output from the function will be a list of the names of the repositories that the user has, along with the number of commits that are in each of the listed repositories.
So, for example, if user John567 has 2 repositories named "Triangle567" and "Square567" each with some number of commits, then the function might output :
Repo: Triangle567 Number of commits: 10 Repo: Square567 Number of commits: 27
Retrieving a user's repositories:
To retrieve a user's list of repositories use this GitHub API:
https://api.github.com/users//repos
Given a user
For example, for the user "richkempinski" the URL would be:
https://api.github.com/users/richkempinski/repos
Put this URL into browser to see the list of json results that are returned. See that one of the repositories returned has the name "hellogitworld"
Retrieving the commits of a repository:
To retrieve the commits for a specific user repository, use this API:
https://api.github.com/repos// /commits
This API will take a user
For example, for the user "richkempinski" and for the repository "hellogitworld" then th e URL would be:
https://api.github.com/repos/richkempinski/hellogitworld/commits
Put this URL into the browser to see the list of commits for the repo.
Recommended Modules:
use these modules in your program to make requests and to handle the results.
import requests
The requests module can be used to request data from the GitHub API service.
import json
The json module can be used to parse the json response data from the GitHub API.
.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started