File: //home/arjun/projects/buyercall/buyercall/blueprints/sysadmin/utilities/generate_curl.py
class GenerateCurl:
@staticmethod
def curl_generate(request):
# Get the request method (e.g., GET, POST, etc.)
method = request.method
# Get the URL
url = request.url
# Get the headers
headers = ''
for key, value in request.headers:
headers += f'-H "{key}: {value}" '
# Get the request body (if applicable)
body = request.data
# Construct the curl command
curl_command = f'curl -X {method} {headers} -d \'{body.decode("utf-8")}\' {url}'
return curl_command