Created
October 1, 2014 21:13
-
-
Save fpersson/fb6514f2c803d5043a77 to your computer and use it in GitHub Desktop.
How to list my public gist
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
import pycurl | |
import json | |
from StringIO import StringIO | |
from pprint import pprint | |
buffer = StringIO() | |
c = pycurl.Curl() | |
c.setopt(c.URL, 'https://api.github.com/users/fpersson/gists') | |
c.setopt(c.WRITEFUNCTION, buffer.write) | |
c.perform() | |
c.close() | |
body = buffer.getvalue() | |
data = json.loads(body) | |
print len(data) | |
for i in range(len(data)): | |
print "\nDescription: ",data[i]['description']," (",data[i]['html_url'],")" | |
for items in data[i]['files']: | |
print data[i]['files'][items]['filename'], " - ", data[i]['files'][items]['language'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment