Skip to content

Instantly share code, notes, and snippets.

@fstamour
Created November 25, 2016 15:35
Show Gist options
  • Save fstamour/f0da19b3195aad2ea2058f9235d8d5d3 to your computer and use it in GitHub Desktop.
Save fstamour/f0da19b3195aad2ea2058f9235d8d5d3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import http.client
import json
if __name__ == '__main__':
if len(sys.argv) < 2:
print("USAGE: gist.py gist-id")
sys.exit(1)
gist_id = sys.argv[1]
conn = http.client.HTTPSConnection('api.github.com')
conn.request('GET', '/gists/' + gist_id, headers={'User-Agent': 'gist.py'})
response = conn.getresponse().read().decode()
print(json.loads(responseresponse.read().decode()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment