Skip to content

Instantly share code, notes, and snippets.

@ustroetz
Last active August 29, 2015 14:17
Show Gist options
  • Save ustroetz/32ff81160e79edbd2c94 to your computer and use it in GitHub Desktop.
Save ustroetz/32ff81160e79edbd2c94 to your computer and use it in GitHub Desktop.
githubpy file upload example
import githubpy
sample_string = "I am a test"
filename = test.txt
commit_message = "Upload test file"
gh = githubpy.GitHub(access_token=token)
encoded_file = base64.b64encode(sample_string)
gh.repos(owner)(repo_name)('contents')(filename).put(path=filename,message=commit_file, content=encoded_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment