http://docs.python.jp/2/howto/urllib2.html
point
If you do not pass the data argument, urllib2 makes use of the GET request.
That means POST if you pass an argument
import urllib import urllib2 import json
url = 'http://api.hoge.json' params = { 'status': 1 } data = urllib.urlencode(params) req = urllib2.Request(url, data) response = urllib2.urlopen(req) json_acceptable_string = response.read().replace("'", """) data = json.loads(json_acceptable_string)
Recommended Posts