This code produces a POST request:
urllib2.urlopen("http://somedomain.com/", data)
I would like to produce a GET request - any ideas on how to do that?
Thanks for the help!
Try:
urllib2.urlopen("http://somedomain.com/?" + data)
[edited]
If you want to send xml/json/etc data in the body, use something like:
urllib2.urlopen("http://somedomain.com/?" + parameters, data)
This will use the POST method, but any "GET" parameters will also be available to your application.
Alternatively, you also use requests
that has a more explicit API:
r = requests.get('https://github.com/timeline.json')
r = requests.post("http://httpbin.org/post")