Last active
November 8, 2016 10:42
-
-
Save rathankalluri/5375a4295d9d8f5c74803a1eb47279f0 to your computer and use it in GitHub Desktop.
Get your Gists from your Gist account Python
This file contains 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 | |
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