Simple Python script to fetch basic public information from any GitHub user profile using the GitHub REST API.
This script retrieves a user's name, number of public repositories, and follower count. It uses a personal access token for authenticated requests (recommended to avoid rate limits).
- Python 3.6+
- requests library
-
Install the dependency:
pip install requests
-
Set the following environment variables:
MY_GITHUB_TOKEN— Your GitHub Personal Access Token (classic or fine-grained withread:userscope)MY_GITHUB_USERNAME— The GitHub username you want to look up
Run the script:
python app.pySuccess!
Name: The Octocat
Repos: 8
Followers: 12345
- The token is only used for authentication and higher rate limits.
- Never commit your token to version control.
- For production use, consider the official
PyGithublibrary.
MIT
Would you like me to also create a `requirements.txt` or improve the script itself (better error handling, JSON output, etc.)?