# PycURL – A Python Interface To The cURL library

PycURL is a Python interface to libcurl, the multiprotocol file transfer library. Similarly to the urllib Python module, PycURL can be used to fetch objects identified by a URL from a Python program. Beyond simple fetches however PycURL exposes most of the functionality of libcurl, including:

- Speed - libcurl is very fast and PycURL, being a thin wrapper above libcurl, is very fast as well. PycURL was benchmarked to be several times faster than Requests.

- Features including multiple protocol support, SSL, authentication and proxy options. PycURL supports most of libcurl’s callbacks.

- Multi and share interfaces.

- Sockets used for network operations, permitting integration of PycURL into the application’s I/O loop (e.g., using Tornado).

## PycURL vs Requests

Requests is another popular Python library that is frequently compared to PycURL.

Advantages of PycURL:

- PycURL can be several times faster than Requests. The performance difference is larger when there are multiple requests performed and connections are reused.

- PycURL makes it possible to take advantage of I/O multiplexing via the libcurl multi interface.

- PycURL supports many protocols, not just HTTP.

- PycURL generally provides more features, for example ability to use several TLS backends, more authentication options, etc.

Advantages of Requests:

- Requests is written in pure Python and does not require C extensions. As a result, Requests is trivial to install while PycURL’s installation can be complex (though operating system-specific packages, if available, negate this drawback).

- Requests’ API is generally easier to learn and use than PycURL’s.

## About libcurl

- libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer resume, http proxy tunneling and more!

- libcurl is highly portable, it builds and works identically on numerous platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more…

- libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported, fast, thoroughly documented and is already used by many known, big and successful companies and numerous applications.

## Requirements

- Python 3.

- libcurl 7.19.0 or better.

## Installation

On Unix, PycURL is easiest to install using your operating system’s package manager. This will also install libcurl and other dependencies as needed.

Installation via easy_install and pip is also supported:

    easy_install pycurl
    pip install pycurl

If this does not work, please see PycURL Installation.

On Windows, build from source or use a third-party binary package.

## Support

For support questions, please use curl-and-python mailing list. Mailing list archives are available for your perusal as well.

Although not an official support venue, Stack Overflow has been popular with PycURL users as well.

Bugs can be reported via GitHub. Please only use GitHub issues when you are certain you have found a bug in PycURL. If you do not have a patch to fix the bug, or at least a specific code fragment in PycURL that you believe is the cause, you should instead post your inquiry to the mailing list.

## Documentation Contents

- Release Notes
  - PycURL 7.45.7 - 2025-09-23
  - PycURL 7.45.6 - 2025-03-06
  - PycURL 7.45.5 - 2025-03-06
  - PycURL 7.45.4 - 2024-12-12
  - PycURL 7.45.3 - 2024-02-17
  - PycURL 7.45.2 - 2022-12-16
  - PycURL 7.45.1 - 2022-03-13
  - PycURL 7.45.0 - 2022-03-09
  - PycURL 7.44.1 - 2021-08-15
  - PycURL 7.44.0 - 2021-08-08
  - PycURL 7.43.0.6 - 2020-09-02
  - PycURL 7.43.0.5 - 2020-01-29
  - PycURL 7.43.0.4 - 2020-01-15
  - PycURL 7.43.0.3 - 2019-06-17
  - PycURL 7.43.0.2 - 2018-06-02
  - PycURL 7.43.0.1 - 2017-12-07
  - PycURL 7.43.0 - 2016-02-02
  - PycURL 7.21.5 - 2016-01-05
  - PycURL 7.19.5.3 - 2015-11-03
  - PycURL 7.19.5.2 - 2015-11-02
  - PycURL 7.19.5.1 - 2015-01-06
  - PycURL 7.19.5 - 2014-07-12
  - PycURL 7.19.3.1 - 2014-02-05
  - PycURL 7.19.3 - 2014-01-09
- PycURL Installation
  - Distutils
  - easy_install / pip
  - Windows
  - Git Checkout
  - A Note Regarding SSL Backends
  - SSL Certificate Bundle
- PycURL Quick Start
  - Retrieving A Network Resource
  - Working With HTTPS
  - Troubleshooting
  - Examining Response Headers
  - Writing To A File
  - Following Redirects
  - Setting Options
  - Examining Response
  - Sending Form Data
  - File Upload - Multipart POST
  - File Upload - PUT
- Troubleshooting
  - `setopt`-Related Issues
  - Transfer-Related Issues
- pycurl Module Functionality
  - `global_init()`
  - `global_cleanup()`
  - `version`
  - `version_info()`
- Curl Object
  - `Curl`
- CurlMulti Object
  - `CurlMulti`
- CurlShare Object
  - `CurlShare`
- Callbacks
  - Error Reporting
  - WRITEFUNCTION
  - HEADERFUNCTION
  - READFUNCTION
  - SEEKFUNCTION
  - IOCTLFUNCTION
  - DEBUGFUNCTION
  - PROGRESSFUNCTION
  - XFERINFOFUNCTION
  - OPENSOCKETFUNCTION
  - CLOSESOCKETFUNCTION
  - SOCKOPTFUNCTION
  - SSH_KEYFUNCTION
  - TIMERFUNCTION
  - SOCKETFUNCTION
  - PREREQFUNCTION
- curl Module Functionality
  - High Level Curl Object
- String And Unicode Handling
  - Setting Options - Python 2.x
  - Setting Options - Python 3.x
  - Writing To Files
  - Writing To StringIO/BytesIO
  - Header Functions
  - Read Functions
  - How PycURL Handles Unicode Strings
  - Figuring Out Correct Encoding
  - Legacy PycURL Versions
- File Handling
- Thread Safety
- Unimplemented Options And Constants
  - `*DATA` options
  - `CURLINFO_TLS_SESSION`
  - Undocumented symbols

# Indices and tables

- Index

- Module Index

- Search Page