Skip to content

Instantly share code, notes, and snippets.

@peterjpxie
Created July 10, 2019 06:14
Show Gist options
  • Save peterjpxie/ead7301b4ca3c7afcea5eb2ce9a31601 to your computer and use it in GitHub Desktop.
Save peterjpxie/ead7301b4ca3c7afcea5eb2ce9a31601 to your computer and use it in GitHub Desktop.
postman code snippet - python
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