Body I’m trying to send:
JavaScript
x
10
10
1
update_request={
2
"id": "f07de0a44c2911ea8fb2bc764e10b970",
3
"user": {
4
"user": "3491574055045",
5
"timestamp": "1640049459",
6
"signature": "YQvl1dWkN6MrHQ8xGwEQndVo2QdPSzc6EqLJslzNjy4%3D",
7
"code": "test"
8
}
9
}
10
This is my code right now:
JavaScript
1
20
20
1
url = "https://api.ordergroove.com/customer/update_customer"
2
3
headers = {
4
'content-type': 'application/json'
5
}
6
7
body = """
8
update_request={{
9
"id": "f07de0a44c2911ea8fb2bc764e10b970",
10
"user": {
11
"timestamp": "1640049459",
12
"signature": "YQvl1dWkN6MrHQ8xGwEQndVo2QdPSzc6EqLJslzNjy4%3D",
13
"code": "test"
14
}
15
}}
16
"""
17
18
#Send and print response
19
response = requests.post(url, data=body, headers=headers)
20
If I run this in Postman though it works just fine: Postman screenshot
Advertisement
Answer
JavaScript
1
13
13
1
import requests
2
3
url = "https://46463d29-e52d-4bb9-bdda-68f0dfd7d06d.mock.pstmn.io/test"
4
5
payload = " update_request={{rn "id": "f07de0a44c2911ea8fb2bc764e10b970",rn "user": {rn "timestamp": "1640049459",rn "signature": "YQvl1dWkN6MrHQ8xGwEQndVo2QdPSzc6EqLJslzNjy4%3D",rn "code": "test"rn }rn }}"
6
headers = {
7
'Content-Type': 'text/plain'
8
}
9
10
response = requests.request("GET", url, headers=headers, data=payload)
11
12
print(response.text)
13
you can geenrate the code form postman itself