Skip to content

Instantly share code, notes, and snippets.

@andreafortuna

andreafortuna/gist.py Secret

Created Aug 28, 2017
Embed
What would you like to do?
#!/usr/bin/python
import os, requests, sys, json
username=sys.argv[2]
password=sys.argv[3]
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))
print(r.json()['html_url'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.