Skip to content

Instantly share code, notes, and snippets.

@diegorocha
Last active November 21, 2017 18:34
Show Gist options
  • Save diegorocha/eb2f3c026d4500c1eb52f62b088b193e to your computer and use it in GitHub Desktop.
Save diegorocha/eb2f3c026d4500c1eb52f62b088b193e to your computer and use it in GitHub Desktop.
Snippet útil para gerar um comando curl equivalente a um request feito com o módulo requests do python.
curl = lambda r: "curl -i -X {method} -H {headers} -d '{data}' '{uri}'".format(method=r.request.method, headers=" -H ".join(['"{0}: {1}"'.format(k, v) for k, v in r.request.headers.items()]), data=r.request.body if r.request.body else '', uri=r.request.url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment