Skip to main content

Fetch data from GitHub

Project description

pygethub

Build codecov License: MIT Python 3.10

pygethub is a simple Python library for working with the GitHub API. It provides easy-to-use functions for common tasks and supports pagination through the API responses.

Features

  • Get a list of commits for a specific repository.
  • Get a list of branches for a specific repository.
  • List GitHub users and organizations.
  • List repositories for a specific organization or user.
  • Get a list of contributors for a specific repository.
  • Check the rate limit for the authenticated user.
  • Start and resume pagination of global resources.

Installation

To install pygethub, you can use pip:

pip install pygethub

Usage

Here is an example of how you can use pygethub:

from pygethub import list_commits, GitHubPaginator, list_users

# List commits for a specific repository
commits = list_commits('owner', 'repo', 'your-github-token')
print(commits)

# Use pagination to list users
paginator = GitHubPaginator('your-github-token')

# List users from the beginning, include other request parameters as keyword arguments
users = paginator.get_paginator(list_users)
for user in users:
    print(user)

# If you want to resume the listing from a certain user ID, use the `since` parameter
users = paginator.get_paginator(list_users, since=500)
for user in users:
    print(user)

# Similarly, you can use the `since` parameter with list_organizations to resume listing from a certain organization ID

Development

To install pygethub, along with the tools you need to develop and run tests, run the following in your virtual environment:

pip install -e .[dev,test]

Contributing

Contributions are welcome! Please read our Contributing Guide on how to contribute to pygethub.

License

pygethub is licensed under the terms of the MIT license. See the LICENSE file for the full license text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygethub-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

pygethub-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pygethub-0.1.0.tar.gz.

File metadata

  • Download URL: pygethub-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for pygethub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dba2196784818b807a6a4af28cd854055e6a789f1a5c6ab294ad49e91067b28d
MD5 a41be5aca1aedfb40d24581356954b63
BLAKE2b-256 3475d099842faf1d38c2bcc6c58891d747164db48d6be5428459395a1798c7ee

See more details on using hashes here.

File details

Details for the file pygethub-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pygethub-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for pygethub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8e4496aebe7058040bd72344039c9ad5d6286e7e87f534490475803ca06c2e
MD5 84e02b1f0841090d0b3e241eb16af900
BLAKE2b-256 84bdca38e33ed70a25626b062e6095e37cfb4bcff4ac43821aae0cfb27322b4a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page