 #  cURL to Python Converter

Convert cURL commands to Python code instantly with support for requests, httpx, aiohttp, and curl\_cffi

 

 ####  Copy as cURL from Browser

- [Chrome DevTools](https://scrapfly.io/blog/answers/how-to-copy-as-curl-with-chrome/)
- [Firefox DevTools](https://scrapfly.io/blog/answers/how-to-copy-as-curl-with-firefox/)
- [Safari DevTools](https://scrapfly.io/blog/answers/how-to-copy-as-curl-with-safari/)
- [Brave DevTools](https://scrapfly.io/blog/answers/how-to-copy-as-curl-with-brave/)
- [Edge DevTools](https://scrapfly.io/blog/answers/how-to-copy-as-curl-with-edge/)
 
 

####  Supported Libraries

- [requests - Simple &amp; Popular](https://scrapfly.io/web-scraping-tools/curl-python/requests)
- [httpx - Modern Async](https://scrapfly.io/web-scraping-tools/curl-python/httpx)
- [aiohttp - High Performance](https://scrapfly.io/web-scraping-tools/curl-python/aiohttp)
- [curl\_cffi - TLS Fingerprinting](https://scrapfly.io/web-scraping-tools/curl-python/curl_cffi)
 
 

####  Quick Examples

- [Simple GET request](https://scrapfly.io/javascript:void(0))
- [With custom headers](https://scrapfly.io/javascript:void(0))
- [POST with JSON data](https://scrapfly.io/javascript:void(0))
- [With authentication](https://scrapfly.io/javascript:void(0))
- [With cookies](https://scrapfly.io/javascript:void(0))
 
 

 

  [requests](https://scrapfly.io/web-scraping-tools/curl-python/requests) [httpx](https://scrapfly.io/web-scraping-tools/curl-python/httpx) [aiohttp](https://scrapfly.io/web-scraping-tools/curl-python/aiohttp) [curl\_cffi](https://scrapfly.io/web-scraping-tools/curl-python/curl_cffi) 

 ###  Paste your cURL Command



   [  Try in Scrapfly Playground ](https://scrapfly.io/register?redirect=%2Fdashboard%2Fplayground%2Fweb-scraper) 

 

 ####  🌐 requests - Simple and elegant HTTP library 

 

   

 [  GitHub Repository ](https://github.com/psf/requests) [  Documentation ](https://requests.readthedocs.io/en/latest/) [  PyPI Package ](https://pypi.org/project/requests/) 

 

 

##  What changes when a cURL command becomes requests code

 `requests` takes a keyword argument for almost everything cURL passes as a flag, so most of the conversion is a mapping: `-H` becomes the `headers` dict, `-b` becomes `cookies`, `-u` becomes the `auth` tuple, `-d` becomes `data`, and a JSON body is better passed as `json=` so the library sets `Content-Type` and serialises for you.

 Three differences bite in practice. First, `requests` follows redirects by default while `curl` only does with `-L`, so a converted command can silently land on a different URL — pass `allow_redirects=False` to match. Second, header order and casing are not preserved: the underlying `urllib3` connection pool emits its own order, which is one of the reasons a request that works in the terminal gets challenged from Python. Third, `requests` has no timeout by default; cURL has none either, but a scraper without one hangs a worker forever, so set `timeout=` on every call.

 For anything beyond a single call, reuse a `requests.Session`: it keeps the connection pool and the cookie jar, which is what makes a login survive to the next request. If the target answers your Python code differently from your terminal, the gap is usually the TLS handshake rather than the headers — compare both with the [JA3 fingerprint tool](https://scrapfly.io/web-scraping-tools/ja3-fingerprint), or switch to [curl\_cffi](https://scrapfly.io/web-scraping-tools/curl-python/curl_cffi), which can impersonate a real browser handshake.

 

  ###  Need Help?

 Learn more about [using cURL for web scraping](https://scrapfly.io/blog/posts/how-to-use-curl-for-web-scraping) or explore our [guide to cURL with JSON](https://scrapfly.io/blog/posts/how-to-curl-json). Found a bug or something missing? [Contact our support team](https://scrapfly.io/docs/support#contact) or [contribute on GitHub](https://github.com/scrapfly).

 

---

## Learn Web Scraping With Python

 [ Introduction tutorial to web scraping with Python. How to collect and parse public data. Challenges, best practices and an example project.

 

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python/ "Python Web Scraping Tutorial and Example Project") 

 [ Tutorial on web scraping with scrapy and Python through a real world example project. Best practices, extension highlights and common challenges.

 

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-scrapy "Web Scraping With Scrapy: The Complete Guide") 

 [ BeautifulSoup is one of the most popular libraries used in web scraping. It's used to parse HTML documents for data either through Python scripting or the use of CSS selectors.

 

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python-beautifulsoup/ "Web Scraping with Python and BeautifulSoup")