Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

python request.push : how to post data

Hi I have installed postman and I can post data to my server now I need to post data in python code. here is the postman:
enter image description here

and it is working I can post the data so I want to know how I can post it in my python using request. post.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I’d recommend the requests library. Here is the documentation for creating POST requests.

import requests

post_headers = {'Content-Type': 'application/x-www-form-urlencoded'}
post_data = {'userIds[0]' : 'A', 'userIds[1]' : 'B'}

resp = requests.post('url', headers=post_headers, json=post_data)

If you have something like and Auth-Token, include it in the post_headers.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading