cURL to Python and Node.js Converter

Paste a curl command, or a request copied as cURL from Chrome, Edge, Firefox or Safari, and get the same request as Python requests, Node.js fetch or a Scrape.do API call. Bash and Windows cmd copies both work, every option it can't convert is listed, and the command never leaves your browser.

  • Free, no signup
  • Runs in your browser
  • Nothing is uploaded

Your code shows up here as you paste. Nothing is uploaded: the conversion runs in this tab.

Converts -X, -H, -d, --data-raw, --data-urlencode, --json, -F, -b, -u, -A, -e, -G, -I, -L, -k and --compressed. Anything else is listed here, never dropped silently.

How to use the cURL converter

  1. Copy a request as cURL. In your browser's DevTools, open the Network panel, right-click a request and copy it as cURL. Steps for each browser are below.
  2. Paste it in the box above. No command at hand? Click Example for a GraphQL request copied from Chrome.
  3. Pick the output: Python requests, Node.js fetch, or the same request as a Scrape.do API call.
  4. Check the bar under the code. It shows the method, host, headers, cookies and body it found, plus any option it did not convert.

How to copy a request as cURL

  • In Chrome and Edge, right-click the request in the Network panel, then Copy > Copy as cURL. On Windows you get a bash and a cmd entry, and both work here.
  • In Firefox, right-click the request in the Network Monitor and pick Copy as cURL from the copy menu. On Windows it offers a POSIX and a Windows version.
  • In Safari, right-click the request in Web Inspector's Network tab and choose Copy as cURL.

Need the API calls behind a whole page, not one request? Record it as a HAR file and open it in the HAR File Analyzer, which copies any request as cURL, Python or a Scrape.do call.

Which curl options are converted

curl optionWhat it doesIn the code
-X, --requestSets the methodrequests.put(...), method: "PUT"
-H, --headerAdds a headerheaders dict or object
-d, --data, --data-raw, --data-binarySends a body, POST by defaultjson= or data=, body:
--data-urlencodeURL-encodes the value firstEncoded into the body or the query
--jsonJSON body plus JSON Content-Type and Acceptjson=, JSON.stringify(...)
-F, --formMultipart form, files with @files= and data=, FormData
-b, --cookieSends cookiescookies dict, Cookie header
-u, --userBasic authAuthorization: Basic header
-A, -eUser-Agent and RefererHeaders
-G, --getMoves the data into the query stringPart of the URL
-I, --headHEAD requestrequests.head(...)
-L, --locationFollows redirectsWithout -L the code stops at the first response: allow_redirects=False, redirect: "manual"
-k, --insecureSkips the TLS certificate checkverify=False, a note for Node
--compressedAsks for a compressed responseAutomatic in both

--url, --oauth2-bearer, --url-query, --form-string and -H 'Name:' (which removes a header) work too. Combined short flags like -sSL and attached values like -XPOST are read the way curl reads them.

cURL to Python requests: what changes

The Python code does what the curl command does, in the shape requests expects:

  • A JSON body becomes a dict passed as json=. true, false and null turn into True, False and None.
  • A form body like a=1&b=2 becomes a data= dict. Text that isn't a clean form is sent byte for byte, with the Content-Type curl would have sent.
  • Cookies move out of the header into a cookies dict.
  • Query strings split into a params dict when that rebuilds the same URL. Signed or oddly encoded URLs stay as they are.
  • Accept-Encoding is dropped. requests decompresses gzip and deflate on its own.

cURL to Node.js fetch

The Node version uses the fetch built into Node.js 18 and later, with no package to install. Save it as a .mjs file so the top-level await works. A JSON body is written with JSON.stringify, a clean form with URLSearchParams, and -F uploads with FormData. Node, unlike a browser, lets you set the Cookie header, so copied cookies work as is.

Send the request through Scrape.do

The Scrape.do tab writes the same request as a call to the Scrape.do API, with the target URL as the url parameter (requests URL-encodes it) and YOUR_TOKEN in place of your API token.

By default it uses extraHeaders mode. The headers that matter to the site, like API keys, Origin, Referer and the cookies, go with an sd- prefix, and Scrape.do generates the browser headers so they match its proxies and fingerprint. Take this request copied from Chrome:

curl 'https://httpbin.co/anything/api/products?page=2' \
  -H 'accept: application/json' \
  -H 'x-api-key: demo-key-123' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
  -b 'session=abc123'

The converter turns it into this call. When we ran it on November 23, 2026, it returned a 200, and the site received the API key, the cookie and page=2, with a User-Agent from Scrape.do instead of the copied one:

import requests

token = "YOUR_TOKEN"

# Scrape.do follows redirects (up to 10). The curl command has no -L, so add
# "disableRedirection": "true" to params to get the first response, like curl.
params = {
    "token": token,
    "url": "https://httpbin.co/anything/api/products?page=2",
    "extraHeaders": "true",
}

# extraHeaders=true: sd- headers reach the target without the prefix,
# on top of the browser headers Scrape.do generates
headers = {
    "sd-accept": "application/json",
    "sd-x-api-key": "demo-key-123",
    "sd-Cookie": "session=abc123",
}

response = requests.get("https://api.scrape.do/", params=params, headers=headers)
print(response.status_code)
print(response.text[:500])

Switch the header mode to customHeaders to forward every header in the command as is, or to No headers to send only the URL and the body. When you run the Scrape.do call, it sends the cookies and tokens you pasted to the Scrape.do API, so use test credentials.

More free tools

All free tools

F.A.Q

Frequently asked questions

No. The command is parsed by JavaScript in your browser tab and the tool makes no network request with it. Session recording is masked for the converter too, since a copied request often carries cookies and tokens. Close the tab and it's gone.

Paste the command in the box above and open the Python tab. Headers become a headers dict, cookies a cookies dict, a JSON body a json= argument and a form body a data= dict, so you can change one value without editing a long string. Copy it and run it with pip install requests.

Yes. Chrome and Edge on Windows offer Copy as cURL (cmd), which wraps every value in ^"...^" and escapes quotes with carets and backslashes. The converter reads that format and the bash one, including the $'...' strings browsers use for bodies with quotes or line breaks.

They have no direct match in Python requests or fetch, or they only change what curl prints. A proxy (-x), a timeout (--max-time), an output file (-o) or a cookie file (-b cookies.txt) is listed with the reason, so you can add it to your code yourself. Nothing is dropped without a note.

Usually the session expired, or the site checks more than headers. Cookies and tokens copied from DevTools time out, and many anti-bot systems compare the TLS fingerprint with the User-Agent, which plain requests can't match. Use the Scrape.do tab to send the same request through rotating proxies with a real browser fingerprint. Our guide to 403 errors in Python requests covers the other causes.