Skip to content

Instantly share code, notes, and snippets.

@fpersson
Created October 1, 2014 21:13
Show Gist options
  • Save fpersson/fb6514f2c803d5043a77 to your computer and use it in GitHub Desktop.
Save fpersson/fb6514f2c803d5043a77 to your computer and use it in GitHub Desktop.
How to list my public gist
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