Home > front end >  How to send raw data in a POST request Python
How to send raw data in a POST request Python

Time:12-21

Body I'm trying to send:

update_request={
        "id": "f07de0a44c2911ea8fb2bc764e10b970",
        "user": {
            "user": "3491574055045",
            "timestamp": "1640049459",
            "signature": "YQvl1dWkN6MrHQ8xGwEQndVo2QdPSzc6EqLJslzNjy4=",
            "code": "test"
        }
    }

This is my code right now:

url = "https://api.ordergroove.com/customer/update_customer"

headers = {
    'content-type': 'application/json'
}

body = """
    update_request={{
         "id": "f07de0a44c2911ea8fb2bc764e10b970",
         "user": {
             "timestamp": "1640049459",
             "signature": "YQvl1dWkN6MrHQ8xGwEQndVo2QdPSzc6EqLJslzNjy4=",
             "code": "test"
         }
     }}
"""

#Send and print response
response = requests.post(url, data=body, headers=headers)

If I run this in Postman though it works just fine: enter image description here

  • Related