Skip to content

Instantly share code, notes, and snippets.

@rathankalluri
Last active November 8, 2016 10:42
Show Gist options
  • Save rathankalluri/5375a4295d9d8f5c74803a1eb47279f0 to your computer and use it in GitHub Desktop.
Save rathankalluri/5375a4295d9d8f5c74803a1eb47279f0 to your computer and use it in GitHub Desktop.
Get your Gists from your Gist account Python
#! /usr/bin/python
import urllib, json
URL = "https://api.github.com/users/rathankalluri/gists" #https://api.github.com/users/<git-hub username>/gists
response = urllib.urlopen(URL)
data = json.loads(response.read())
for i in range(0,len(data)):
filename = data[i]['files'].values()[0]['filename']
gisturl = 'https://api.github.com/gists/'+data[i]['id']
gistdata = json.loads(urllib.urlopen(gisturl).read())
description = gistdata['description']
content = gistdata['files'][filename]['content']
print(description)
print(content)
print('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment