Created
July 10, 2019 06:14
-
-
Save peterjpxie/ead7301b4ca3c7afcea5eb2ce9a31601 to your computer and use it in GitHub Desktop.
postman code snippet - python
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
import requests | |
url = "http://httpbin.org/post" | |
payload = "{\n \"key1\": 1,\n \"key2\": \"value2\"\n}" | |
headers = { | |
'Content-Type': "application/json,text/plain", | |
'User-Agent': "PostmanRuntime/7.15.0", | |
'Accept': "*/*", | |
'Cache-Control': "no-cache", | |
'Postman-Token': "e908a437-88ea-4b00-af53-7a9a49033830,ba90e008-0f7f-4576-beb8-b7739c8961f1", | |
'Host': "httpbin.org", | |
'accept-encoding': "gzip, deflate", | |
'content-length': "42", | |
'Connection': "keep-alive", | |
'cache-control': "no-cache" | |
} | |
response = requests.request("POST", url, data=payload, headers=headers) | |
print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment