# cURL Converter: cURL to Python and Node.js > Source: https://scrape.do/tools/curl-converter/ Free cURL converter. Paste a curl command or a Copy as cURL from DevTools and get Python requests, Node fetch or a Scrape.do API call. Nothing is uploaded. 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. ## 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](/tools/har-analyzer/), which copies any request as cURL, Python or a Scrape.do call. ## Which curl options are converted | curl option | What it does | In the code | |---|---|---| | `-X`, `--request` | Sets the method | `requests.put(...)`, `method: "PUT"` | | `-H`, `--header` | Adds a header | `headers` dict or object | | `-d`, `--data`, `--data-raw`, `--data-binary` | Sends a body, POST by default | `json=` or `data=`, `body:` | | `--data-urlencode` | URL-encodes the value first | Encoded into the body or the query | | `--json` | JSON body plus JSON `Content-Type` and `Accept` | `json=`, `JSON.stringify(...)` | | `-F`, `--form` | Multipart form, files with `@` | `files=` and `data=`, `FormData` | | `-b`, `--cookie` | Sends cookies | `cookies` dict, `Cookie` header | | `-u`, `--user` | Basic auth | `Authorization: Basic` header | | `-A`, `-e` | User-Agent and Referer | Headers | | `-G`, `--get` | Moves the data into the query string | Part of the URL | | `-I`, `--head` | HEAD request | `requests.head(...)` | | `-L`, `--location` | Follows redirects | Without `-L` the code stops at the first response: `allow_redirects=False`, `redirect: "manual"` | | `-k`, `--insecure` | Skips the TLS certificate check | `verify=False`, a note for Node | | `--compressed` | Asks for a compressed response | Automatic 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](/documentation/), 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](/documentation/headers-cookies/extra-headers/). 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: ```bash 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: ```python 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](/documentation/headers-cookies/custom-headers/) 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. ## Related reading - [HAR File Analyzer](/tools/har-analyzer/), to find the API calls behind a page and copy them as cURL - [Why You're Getting 403 in Python Requests](/blog/python-requests-403-forbidden/) - [Cookie Handling in Web Scraping](/blog/web-scraping-cookies/) - [Quick Guide to Using Proxies with Python Requests](/blog/python-requests-proxy/), for the `-x` option - [How to Use curl_cffi for Web Scraping](/blog/how-to-use-curl-cffi-for-web-scraping/), for requests that need a browser TLS fingerprint ## FAQ ### Is my curl command uploaded anywhere? 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. ### How do I convert a curl command to Python requests? 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`. ### Does it work with Copy as cURL from Windows? 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. ### Why are some options listed as "Not converted"? 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. ### Why does the Python version get a 403 when curl worked? 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](/blog/python-requests-403-forbidden/) covers the other causes.