Curl is a linux command that allows a user to make requests to or from a network server. It is especially useful for making automated shell scripts for downloading files or posting data.
USE requests.get() OR requests.post() TO MAKE A CURL REQUEST
Call requests.get(url) and requests.post(url, data, headers) to make a curl request, or any web request. The url is the url of the specified endpoint, data is the payload to send, and headers should contain any relevant headers for the request.
url = "https://postman-echo.com/post"
headers = {"content-type": "application/json", "Accept-Charset": "UTF-8"}
r = requests.post(url, data={"sample":"data"}, headers=headers)
post data to url
data = r.json()
store response
print(data)
OUTPUT
{'args': {}, 'data': 'sample=data', 'files': {}, 'form': {}, 'headers': {'x-forwarded-proto': 'https', 'host': 'postman-echo.com', 'content-length': '11', 'accept': '*/*', 'accept-charset': 'UTF-8', 'accept-encoding': 'gzip, deflate', 'content-type': 'application/json', 'user-agent': 'python-requests/2.22.0', 'x-forwarded-port': '443'}, 'json': None, 'url': 'https://postman-echo.com/post'}