curl_cffi
Enum values used by setopt and getinfo can be accessed from CurlOpt and CurlInfo.
AsyncCurl
Wrapper around curl_multi handle to provide asyncio support. It uses the libcurl socket_action APIs.
add_handle(curl, wait=True)
async
Add a curl handle to be managed by curl_multi. This is the equivalent of
perform in the async world.
cancel_handle(curl)
Cancel a future for given curl handle.
close()
Close and cleanup running timers, readers, writers and handles.
process_data(sockfd, ev_bitmask)
Call curl_multi_info_read to read data for given socket.
set_exception(curl, exception)
Raise exception of a future for given curl handle.
set_result(curl)
Mark a future as done for given curl handle.
setopt(option, value)
Wrapper around curl_multi_setopt.
socket_action(sockfd, ev_bitmask)
Call libcurl socket_action function
Curl
Wrapper for curl_easy_* functions of libcurl.
__init__(cacert=DEFAULT_CACERT, debug=False)
| Parameters: |
|
|---|
clean_after_perform(clear_headers=True)
Clean up handles and buffers after perform, called at the end of perform.
close()
Close and cleanup curl handle, wrapper for curl_easy_cleanup
get_reason_phrase(status_line)
Extract reason phrase, like OK, Not Found from response status line.
getinfo(option)
Wrapper for curl_easy_getinfo. Gets information in response after curl perform.
| Parameters: |
|
|---|
impersonate(target, default_headers=True)
Set the browser type to impersonate.
| Parameters: |
|
|---|
parse_cookie_headers(headers)
Extract cookies.SimpleCookie from header lines.
| Parameters: |
|
|---|
| Returns: |
|
|---|
perform(clear_headers=True)
Wrapper for curl_easy_perform, performs a curl request.
| Parameters: |
|
|---|
reset()
Reset all curl options, wrapper for curl_easy_reset.
setopt(option, value)
Wrapper for curl_easy_setopt.
| Parameters: |
|
|---|
version()
Get the underlying libcurl version.
CurlError
Bases: Exception
Base exception for curl_cffi package