Last active
July 18, 2018 03:49
-
-
Save BlogBlocks/71cd9394db91fd089765861ebf121b0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| #USE: python SimpleGistPost.py FileToPost.py | |
| import os, requests, sys, json | |
| import GISTkey | |
| from time import sleep | |
| username=GISTkey.gistkey()[0] | |
| password=GISTkey.gistkey()[1] | |
| filename = os.path.basename(sys.argv[1]) | |
| content=open(filename, 'r').read() | |
| r = requests.post('https://api.github.com/gists',json.dumps({'files':{filename:{"content":content}}}),auth=requests.auth.HTTPBasicAuth(username, password)) | |
| sleep(2) | |
| print(r.json()['html_url']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment