| 1 |
setopt(option, value) -> None |
| 2 |
|
| 3 |
Set curl share option. |
| 4 |
|
| 5 |
Corresponds to `curl_share_setopt`_ in libcurl, where *option* is |
| 6 |
specified with the ``CURLSHOPT_*`` constants in libcurl, except that the |
| 7 |
``CURLSHOPT_`` prefix has been changed to ``SH_``. Currently, *value* must be |
| 8 |
one of: ``LOCK_DATA_COOKIE``, ``LOCK_DATA_DNS``, ``LOCK_DATA_SSL_SESSION`` or |
| 9 |
``LOCK_DATA_CONNECT``. |
| 10 |
|
| 11 |
Example usage:: |
| 12 |
|
| 13 |
import pycurl |
| 14 |
curl = pycurl.Curl() |
| 15 |
s = pycurl.CurlShare() |
| 16 |
s.setopt(pycurl.SH_SHARE, pycurl.LOCK_DATA_COOKIE) |
| 17 |
s.setopt(pycurl.SH_SHARE, pycurl.LOCK_DATA_DNS) |
| 18 |
curl.setopt(pycurl.URL, 'https://curl.haxx.se') |
| 19 |
curl.setopt(pycurl.SHARE, s) |
| 20 |
curl.perform() |
| 21 |
curl.close() |
| 22 |
|
| 23 |
Raises pycurl.error exception upon failure. |
| 24 |
|
| 25 |
.. _curl_share_setopt: |
| 26 |
https://curl.haxx.se/libcurl/c/curl_share_setopt.html |