Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 617 Bytes

File metadata and controls

14 lines (11 loc) · 617 Bytes

Send POST Requests in Python

simple python code to send http POST requests to an API endpoint.

How it works:

Upon calling python3 main.py:

  1. constructs a dictionary for the data payload.
  2. converts dictionary into a JSON object[1].
  3. sends the payload to the specified API via POST request, using the python requests package[2].
  4. prints out the result of the POST request.

Futher readings:

[1] Python JSON encoder and decoder documentation

[2] Python Requests - Quickstart