Learn practical skills, build real-world projects, and advance your career

Problem

QUESTION: Write a Python function that creates a CSV file (comma-separated values) containing details about the 25 top GitHub repositories for any given topic. You can view the top repositories for the topic machine-learning on this page: https://github.com/topics/machine-learning. The output CSV should contain these details: repository name, owner's username, no. of stars, repository URL.

alt

Downloading a web page using requests

We'll use a library called requests to download web pages from the internet. Let's begin by installing and importing the library.

!pip install requests~=2.23.0 --quiet
# Import the library
import requests

We can download a web page using the requests.get function.