This is a simple Python project that demonstrates how to interact with the GitHub API using the PyGithub library.
- Authenticates with a GitHub Personal Access Token.
- Lists all repositories accessible by the authenticated user.
-
Clone the repository:
git clone https://github.com/freedevgraph/github-api-python-project.git cd github-api-python-project -
Install dependencies:
pip install -r requirements.txt
-
Set up your GitHub Personal Access Token: The script expects your GitHub Personal Access Token to be set as an environment variable named
GH_TOKEN. You can generate a new token here. Make sure the token has at leastreposcope to list private repositories.export GH_TOKEN="YOUR_GITHUB_TOKEN"
-
Run the script:
python main.py
Upon running the script, it will print the login of the authenticated user and then list the names of all repositories associated with that user.
Feel free to fork this repository, make improvements, and submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.