Created
September 19, 2015 09:36
-
-
Save ayushgoel/f8895bdedda8e9363152 to your computer and use it in GitHub Desktop.
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
# coding: utf-8 | |
#!/usr/bin/env python | |
import urllib2, re, os | |
#from BeautifulSoup import BeautifulSoup | |
#import simplejson as json | |
import json | |
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' | |
def fetchPage(url): | |
req = urllib2.Request(url) | |
req.add_header('User-Agent', user_agent) | |
response = urllib2.urlopen(req) | |
html = response.read() | |
response.close() | |
return html | |
html = fetchPage("http://alltheragefaces.com/api/face/6") | |
print html | |
jsonData = json.JSONDecoder().decode(html) | |
print jsonData |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment