Skip to content

Instantly share code, notes, and snippets.

@bugcy013
Created April 27, 2021 05:24
Show Gist options
  • Save bugcy013/670287b736d5fc2e263daa31d4958603 to your computer and use it in GitHub Desktop.
Save bugcy013/670287b736d5fc2e263daa31d4958603 to your computer and use it in GitHub Desktop.
curl command from python request
req = response.request
command = "curl -X {method} -H {headers} -d '{data}' '{uri}'"
method = req.method
uri = req.url
data = req.body
headers = ['"{0}: {1}"'.format(k, v) for k, v in req.headers.items()]
headers = " -H ".join(headers)
return command.format(method=method, headers=headers, data=data, uri=uri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment