Input cURL
Python Code

Instructions & Python Requests Knowledge

Features

  • Smart Cookie Extraction: The Extract Cookie function is enabled by default. It can automatically separate an independent Cookie dictionary from -H 'Cookie: ...', making Python code more elegant.
  • Auto JSON Parsing: If the cURL contains a JSON-formatted data payload (-d), the tool will automatically attempt to parse it as a Python json=... dictionary argument, avoiding manual string concatenation.
  • Safely Ignore Certificates: Automatically recognizes the -k or --insecure parameters and adds verify=False to the generated request.

Core Usage of Requests Library

  • Passing Parameters: GET requests use params={"key": "value"}; POST request form data uses data={"key": "value"}; POST JSON data uses json={"key": "value"}.
  • Custom Headers: Passed via headers={"User-Agent": "..."}, Requests will automatically add basic headers like Content-Length for you.
  • Response Handling: response.text returns string-formatted content; response.json() automatically parses the JSON response into a Python dictionary.
  • Session Persistence: If you need multiple requests to maintain login status, it is recommended to use session = requests.Session() instead of requests.get().