This project provides a Python script to fetch and display traffic data (views and clones) for all repositories of a specified GitHub user. It utilizes the GitHub API to gather information on how many people viewed and cloned each repository.
- Fetch a list of all repositories for a specified GitHub user.
- Retrieve traffic views and clones for each repository.
- Display the traffic data for easy analysis.
- Python 3.x
- A GitHub personal access token with appropriate permissions to access repository data.
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
-
Install required Python packages:
This script requires the
requests
library. You can install it using pip:pip install requests
-
Generate a GitHub Personal Access Token:
- Go to your GitHub account.
- Navigate to
Settings
>Developer settings
>Personal access tokens
. - Generate a new token with the
repo
scope.
-
Update the script with your credentials:
Replace the placeholders in the script with your actual GitHub token and username:
GITHUB_TOKEN = "YOUR-API-KEY" USERNAME = "YOUR-USER-NAME"
-
Run the script:
Execute the Python script to fetch and display the traffic data:
python script_name.py
-
Output:
The script will output the repository names, along with their traffic views and clones, in the terminal:
Repository: repo-name Views: {'count': X, 'uniques': Y} Clones: {'count': X, 'uniques': Y} -------------
- If you encounter issues with API access, ensure your GitHub token has the correct permissions.
- API rate limits may apply. If the script fails due to rate limits, wait and try again later.
This project is licensed under the MIT License. See the LICENSE file for more details.
- This project uses the GitHub API to fetch repository data.
- Special thanks to the open-source community for making such resources available.