Skip to main content

Python class for reading and writing data to a GitHub repository

Project description


PyPI CircleCI License

Read and write both small and large files to Github.

The regular GitHub Contents API can't handle files larger than 1MB - this class knows how to spot that proble and switch to the large-file-supporting low level Git Data API instead.

Note that file contents is passed and returned as bytestrings, not regular strings.


You will need a GitHub OAuth token with full repository access.

The easiest way to create one of these is using

# For repo simonw/disaster-data:
github = GithubContents(

To read a file:

content_in_bytes, sha =

To write a file:

content_sha, commit_sha = github.write(
    sha=previous_sha, # Optional
        "name": COMMITTER_NAME,
        "email": COMMITTER_EMAIL,

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for github-contents, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size github_contents-0.1-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page