Skip to content

Instantly share code, notes, and snippets.

@LLyaudet
LLyaudet / req_to_curl.py
Last active November 23, 2022 15:05 — forked from asfaltboy/req_to_curl.py
Django HTTP Request to curl command (for replay)
"""
Convert a Django HTTPRequest object (or dictionary of such a request) into a
cURL command.
"""
def get_curl(request):
def convert(word, delim='-'):
return delim.join(x.capitalize() or '_' for x in word.split('_'))
def get_headers(request):
headers = {