Skip to main content

PyPI version License: MIT Downloads LinkedIn

github_repo_lister

A simple Python package to list public repositories for a given GitHub user.

Installation

To install github_repo_lister, use pip:

pip install github_repo_lister

Usage

The github_repo_lister package allows you to retrieve a list of public repositories for any GitHub user. For authenticated requests (which increases your rate limit), you can set the GITHUB_TOKEN environment variable with your GitHub Personal Access Token.

Basic Example

import os
from github_repo_lister import list_user_repositories

# Optionally, set your GitHub token as an environment variable
# os.environ["GITHUB_TOKEN"] = "YOUR_GITHUB_TOKEN"

# Example for a well-known user
username = "octocat"
repositories_json = list_user_repositories(username)

print(f"Repositories for {username}:")
print(repositories_json)

# Example for a user with no public repositories (or a non-existent user)
username_no_repos = "nonexistentuser12345"
repositories_json_empty = list_user_repositories(username_no_repos)

print(f"\nRepositories for {username_no_repos}:")
print(repositories_json_empty)

How it works

The list_user_repositories function takes a github_username as input. It checks for the GITHUB_TOKEN environment variable to use for authentication. It then constructs a URL for the GitHub API's user repositories endpoint and fetches the data. The function returns the repository information as a JSON string. If an error occurs or no repositories are found, it returns an empty JSON list ([]).

Note: The current implementation in the provided code simulates API responses to avoid making actual network calls. In a real-world scenario, you would uncomment and use the requests library part of the code.

Author

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

github_repo_lister is licensed under the MIT License.

Metadata

Release files for github-repo-lister 2025.9.131919

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for github-repo-lister 2025.9.131919
File Size Uploaded
github_repo_lister-2025.9.131919.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for github-repo-lister 2025.9.131919
File Interpreter ABI Platform
github_repo_lister-2025.9.131919-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / github_repo_lister-2025.9.131919.tar.gz

Download URL github_repo_lister-2025.9.131919.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5d214e579baaadc6d921e3eb78b08a7dce4d2934b634e534ae50479776b0e4f0
BLAKE2b-256 checksum
How to use checksums
b5c175dc7559839bcece951cb8c904b32a3e9c0a65c0c065d565042d70ed8884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / github_repo_lister-2025.9.131919-py3-none-any.whl

Download URL github_repo_lister-2025.9.131919-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b4263cdd12749c4b3be8a22b25b3fe9f9297e913f07040f02a6a6b35f93d0ee
BLAKE2b-256 checksum
How to use checksums
ae0d634330ed83eb2a91bef23443b8e49be0bc6191394f783c76cdfc7fd33ff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

2025.9.131919 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page