How to send mix of GET and POST in python -
i'm trying send mix of , post url using requests module. there way this?
what 've tried following:
import requests payload = {'test': 'test'} r = requests.post("http://httpbin.org/post?key1=val1&key2=val2",params=payload) print r.text
but when see being sent server (i.e. r.text), see being sent via post.
could tell me how can key1 , key2 sent via , test sent via post please?
i tried on google , on stackoveflow couldn't find anything...
edit: clarify i'm attempting do, replicate following request gets sent website: https://dl.dropboxusercontent.com/u/638729/screen%20shot%202015-06-04%20at%2008.43.49.png
thank tak
you can't literally have ask for. request either or post, not both. however, think asking if of parameters can encoded in url while others form-encoded in payload.
try this:
import requests params = {'key1':'val1', 'key2':'val2'} payload = {'test': 'test'} r = requests.post("http://httpbin.org/post",params=params,data=payload) print r.text
Comments
Post a Comment