Skip to content Skip to sidebar Skip to footer

Converting Curl To Python Requests

I need to convert the following cURL command to python requests. curl 'https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json' \ -F 'message=' \ -H '

Solution 1:

 requests.post("https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json, data=json.dumps({"message": "<message>"}), headers={"Authorization": "Bearer <token>"}) 

Post a Comment for "Converting Curl To Python Requests"