{ "info": { "author": "Simon Willison", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# github-contents\n\n[![PyPI](https://img.shields.io/pypi/v/github-contents.svg)](https://pypi.org/project/github-contents/)\n[![CircleCI](https://circleci.com/gh/simonw/github-contents.svg?style=svg)](https://circleci.com/gh/simonw/github-contents)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-json-html/blob/master/LICENSE)\n\nRead and write both small and large files to Github.\n\nThe regular [GitHub Contents API](https://developer.github.com/v3/repos/contents/) 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](https://developer.github.com/v3/git/) instead.\n\nNote that file contents is passed and returned as bytestrings, not regular strings.\n\n## Usage\n\nYou will need a GitHub OAuth token with full repository access.\n\nThe easiest way to create one of these is using [https://github.com/settings/tokens](https://github.com/settings/tokens)\n\n```python\n# For repo simonw/disaster-data:\ngithub = GithubContents(\n \"simonw\",\n \"disaster-data\",\n GITHUB_OAUTH_TOKEN\n)\n```\nTo read a file:\n```python\ncontent_in_bytes, sha = github.read(path_within_repo)\n```\nTo write a file:\n```python\ncontent_sha, commit_sha = github.write(\n filepath=path_within_repo,\n content_bytes=contents_in_bytes,\n sha=previous_sha, # Optional\n commit_message=commit_message,\n committer={\n \"name\": COMMITTER_NAME,\n \"email\": COMMITTER_EMAIL,\n },\n)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/simonw/github-contents", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "github-contents", "package_url": "https://pypi.org/project/github-contents/", "platform": "", "project_url": "https://pypi.org/project/github-contents/", "project_urls": { "Homepage": "https://github.com/simonw/github-contents" }, "release_url": "https://pypi.org/project/github-contents/0.1/", "requires_dist": [ "requests", "pytest ; extra == 'test'", "betamax ; extra == 'test'" ], "requires_python": "", "summary": "Python class for reading and writing data to a GitHub repository", "version": "0.1" }, "last_serial": 5378687, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c1f6ac9126dfce92de0547b0ca84eadd", "sha256": "fc1e544bb8a80069fa04269ed4fd1131d2c6a25efdd75c1c5e9db7aaa6d954e1" }, "downloads": -1, "filename": "github_contents-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c1f6ac9126dfce92de0547b0ca84eadd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3416, "upload_time": "2019-06-09T20:59:16", "url": "https://files.pythonhosted.org/packages/c0/ca/bbec15ae65311cc2bfe3970a7bc1763fe0c913e10a16f47ba02ffc8882bf/github_contents-0.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c1f6ac9126dfce92de0547b0ca84eadd", "sha256": "fc1e544bb8a80069fa04269ed4fd1131d2c6a25efdd75c1c5e9db7aaa6d954e1" }, "downloads": -1, "filename": "github_contents-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c1f6ac9126dfce92de0547b0ca84eadd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3416, "upload_time": "2019-06-09T20:59:16", "url": "https://files.pythonhosted.org/packages/c0/ca/bbec15ae65311cc2bfe3970a7bc1763fe0c913e10a16f47ba02ffc8882bf/github_contents-0.1-py3-none-any.whl" } ] }