| 1 |
PycURL -- A Python Interface To The cURL library |
| 2 |
================================================ |
| 3 |
|
| 4 |
PycURL is a Python interface to `libcurl`_, the multiprotocol file |
| 5 |
transfer library. Similarly to the urllib_ Python module, |
| 6 |
PycURL can be used to fetch objects identified by a URL from a Python program. |
| 7 |
Beyond simple fetches however PycURL exposes most of the functionality of |
| 8 |
libcurl, including: |
| 9 |
|
| 10 |
- Speed - libcurl is very fast and PycURL, being a thin wrapper above |
| 11 |
libcurl, is very fast as well. PycURL `was benchmarked`_ to be several |
| 12 |
times faster than Requests_. |
| 13 |
- Features including multiple protocol support, SSL, authentication and |
| 14 |
proxy options. PycURL supports most of libcurl's callbacks. |
| 15 |
- Multi_ and share_ interfaces. |
| 16 |
- Sockets used for network operations, permitting integration of PycURL |
| 17 |
into the application's I/O loop (e.g., using Tornado_). |
| 18 |
|
| 19 |
.. _was benchmarked: http://stackoverflow.com/questions/15461995/python-requests-vs-pycurl-performance |
| 20 |
.. _Requests: http://python-requests.org/ |
| 21 |
.. _Multi: https://curl.haxx.se/libcurl/c/libcurl-multi.html |
| 22 |
.. _share: https://curl.haxx.se/libcurl/c/libcurl-share.html |
| 23 |
.. _Tornado: http://www.tornadoweb.org/ |
| 24 |
|
| 25 |
|
| 26 |
PycURL vs Requests |
| 27 |
------------------ |
| 28 |
|
| 29 |
Requests_ is another popular Python library that is frequently compared to |
| 30 |
PycURL. |
| 31 |
|
| 32 |
Advantages of PycURL: |
| 33 |
|
| 34 |
- PycURL can be `several times faster than Requests |
| 35 |
<https://github.com/svanoort/python-client-benchmarks>`_. |
| 36 |
The performance difference is larger when there are multiple requests |
| 37 |
performed and connections are reused. |
| 38 |
- PycURL makes it possible to take advantage of I/O multiplexing via the |
| 39 |
`libcurl multi interface <https://curl.haxx.se/libcurl/c/libcurl-multi.html>`_. |
| 40 |
- PycURL supports many protocols, not just HTTP. |
| 41 |
- PycURL generally provides more features, for example ability to use several |
| 42 |
TLS backends, more authentication options, etc. |
| 43 |
|
| 44 |
Advantages of Requests: |
| 45 |
|
| 46 |
- Requests is written in pure Python and does not require C extensions. |
| 47 |
As a result, Requests is trivial to install while PycURL's installation |
| 48 |
can be complex (though operating system-specific packages, if available, |
| 49 |
negate this drawback). |
| 50 |
- Requests' API is generally easier to learn and use than PycURL's. |
| 51 |
|
| 52 |
|
| 53 |
About libcurl |
| 54 |
------------- |
| 55 |
|
| 56 |
- libcurl is a free and easy-to-use client-side URL transfer library, supporting |
| 57 |
DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, |
| 58 |
POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. |
| 59 |
libcurl supports SSL certificates, HTTP POST, HTTP PUT, |
| 60 |
FTP uploading, HTTP form based upload, proxies, cookies, user+password |
| 61 |
authentication (Basic, Digest, NTLM, Negotiate, Kerberos4), file transfer |
| 62 |
resume, http proxy tunneling and more! |
| 63 |
|
| 64 |
- libcurl is highly portable, it builds and works identically on numerous |
| 65 |
platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, |
| 66 |
AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, |
| 67 |
Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more... |
| 68 |
|
| 69 |
- libcurl is `free`_, :ref:`thread-safe <thread-safety>`, `IPv6 compatible`_, `feature rich`_, |
| 70 |
`well supported`_, `fast`_, `thoroughly documented`_ and is already used by |
| 71 |
many known, big and successful `companies`_ and numerous `applications`_. |
| 72 |
|
| 73 |
.. _free: https://curl.haxx.se/docs/copyright.html |
| 74 |
.. _thread-safe: :ref:`thread-safety` |
| 75 |
.. _`IPv6 compatible`: https://curl.haxx.se/libcurl/features.html#ipv6 |
| 76 |
.. _`feature rich`: https://curl.haxx.se/libcurl/features.html#features |
| 77 |
.. _`well supported`: https://curl.haxx.se/libcurl/features.html#support |
| 78 |
.. _`fast`: https://curl.haxx.se/libcurl/features.html#fast |
| 79 |
.. _`thoroughly documented`: https://curl.haxx.se/libcurl/features.html#docs |
| 80 |
.. _companies: https://curl.haxx.se/docs/companies.html |
| 81 |
.. _applications: https://curl.haxx.se/libcurl/using/apps.html |
| 82 |
|
| 83 |
|
| 84 |
Requirements |
| 85 |
------------ |
| 86 |
|
| 87 |
- Python 3. |
| 88 |
- libcurl 7.19.0 or better. |
| 89 |
|
| 90 |
|
| 91 |
Installation |
| 92 |
------------ |
| 93 |
|
| 94 |
On Unix, PycURL is easiest to install using your operating system's package |
| 95 |
manager. This will also install libcurl and other dependencies as needed. |
| 96 |
|
| 97 |
Installation via pip is also supported:: |
| 98 |
|
| 99 |
pip install pycurl |
| 100 |
|
| 101 |
If this does not work, please see :ref:`install`. |
| 102 |
|
| 103 |
On Windows, build from source or use a third-party binary package. |
| 104 |
|
| 105 |
|
| 106 |
Support |
| 107 |
------- |
| 108 |
|
| 109 |
For support questions, please use `curl-and-python mailing list`_. |
| 110 |
`Mailing list archives`_ are available for your perusal as well. |
| 111 |
|
| 112 |
Although not an official support venue, `Stack Overflow`_ has been |
| 113 |
popular with PycURL users as well. |
| 114 |
|
| 115 |
Bugs can be reported `via GitHub`_. Please only use GitHub issues when you are |
| 116 |
certain you have found a bug in PycURL. If you do not have a patch to fix |
| 117 |
the bug, or at least a specific code fragment in PycURL that you believe is |
| 118 |
the cause, you should instead post your inquiry to the mailing list. |
| 119 |
|
| 120 |
.. _curl-and-python mailing list: https://lists.haxx.se/listinfo/curl-and-python |
| 121 |
.. _Stack Overflow: http://stackoverflow.com/questions/tagged/pycurl |
| 122 |
.. _Mailing list archives: https://curl.haxx.se/mail/list.cgi?list=curl-and-python |
| 123 |
.. _via GitHub: https://github.com/pycurl/pycurl/issues |
| 124 |
|
| 125 |
|
| 126 |
Documentation Contents |
| 127 |
---------------------- |
| 128 |
|
| 129 |
.. toctree:: |
| 130 |
:maxdepth: 2 |
| 131 |
|
| 132 |
release-notes |
| 133 |
install |
| 134 |
quickstart |
| 135 |
troubleshooting |
| 136 |
pycurl |
| 137 |
curlobject |
| 138 |
curlmultiobject |
| 139 |
curlshareobject |
| 140 |
mime |
| 141 |
callbacks |
| 142 |
curl |
| 143 |
unicode |
| 144 |
files |
| 145 |
thread-safety |
| 146 |
unimplemented |
| 147 |
|
| 148 |
|
| 149 |
Indices and tables |
| 150 |
================== |
| 151 |
|
| 152 |
* :ref:`genindex` |
| 153 |
* :ref:`modindex` |
| 154 |
* :ref:`search` |
| 155 |
|
| 156 |
.. _libcurl: https://curl.haxx.se/libcurl/ |
| 157 |
.. _urllib: http://docs.python.org/library/urllib.html |