vendredi 2 février 2018

Trouble getting data from REST http service using requests package

This works fine, I can get data returned:

r = urllib2.Request("http://myServer.com:12345/myAction")
data = json.dumps(q) #q is a python dict
r.add_data(data)
r=urllib2.urlopen(r)

But doing the same with requests package fails:

r=requests.get("http://myServer.com:12345/myAction", data=q)
r.text #This will return a message that says method is not allowed.




Aucun commentaire:

Enregistrer un commentaire