curl_cffi の API リファレンス
curl_cffi (lexiforest/curl_cffi) の公開 API 116 件 —— クラス 44、関数 14、メソッド 58。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: lexiforest/curl_cffi
| 種別 | 件数 |
|---|---|
| クラス | 44 |
| 関数 | 14 |
| メソッド | 58 |
API 一覧
class
curl_cffi.aio.AsyncCurlWrapper around curl_multi handle to provide asyncio support.
method
curl_cffi.aio.AsyncCurl.add_handle(curl:Curl)Add a curl handle to be managed by curl_multi.
method
curl_cffi.aio.AsyncCurl.remove_handle(curl:Curl)Cancel a future for given curl handle.
method
curl_cffi.aio.AsyncCurl.set_result(curl:Curl)Mark a future as done for given curl handle.
method
curl_cffi.aio.AsyncCurl.setopt(option, value)Wrapper around curl_multi_setopt.
func
curl_cffi.aio.timer_function(curlm, timeout_ms:int, clientp:Any) -> intsee: https://curl.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html
func
curl_cffi.cli.parse.parse_request_items(items:list[str]) -> ParsedItemsParse request items into structured data.
func
curl_cffi.cli.parse.process_url(url:str) -> strNormalise a URL: localhost shortcut, default scheme.
func
curl_cffi.cli.pro.add_pro_parsers(subparsers) -> NoneRegister update, list, and config subcommands.
func
curl_cffi.cli.pro.handle_pro_command(args) -> boolHandle pro subcommands.
class
curl_cffi.cli.run.HttpFileRequestA single request parsed from an .http file.
func
curl_cffi.cli.run.handle_run(args:argparse.Namespace) -> NoneExecute batch requests.
func
curl_cffi.cli.run.parse_http_file(text:str) -> list[HttpFileRequest]Parse an .http file into a list of requests.
class
curl_cffi.const.CurlFollow``CURLFOLLOW_*`` consts for redirect behavior
class
curl_cffi.curl.CurlWrapper for ``curl_easy_*`` functions of libcurl.
method
curl_cffi.curl.Curl.debug() -> NoneSet debug to True
method
curl_cffi.curl.Curl.duphandle() -> CurlWrapper for ``curl_easy_duphandle``.
method
curl_cffi.curl.Curl.getinfo(option:CurlInfo) -> bytes | int | float | list[str | int]Wrapper for ``curl_easy_getinfo``.
method
curl_cffi.curl.Curl.impersonate(target:str, default_headers:bool=True) -> intSet the browser type to impersonate.
method
curl_cffi.curl.Curl.parse_cookie_headers(headers:list[bytes]) -> SimpleCookieExtract ``cookies.SimpleCookie`` from header lines.
method
curl_cffi.curl.Curl.parse_status_line(status_line:bytes) -> tuple[CurlHttpVersion, int, bytes]Parse status line.
method
curl_cffi.curl.Curl.pause(action:int) -> intPause or resume data transfer on this handle.
method
curl_cffi.curl.Curl.perform(clear_headers:bool=True, clear_resolve:bool=True) -> NoneWrapper for ``curl_easy_perform``, performs a curl request.
method
curl_cffi.curl.Curl.reset() -> NoneReset all curl options, wrapper for ``curl_easy_reset``.
method
curl_cffi.curl.Curl.setopt(option:CurlOpt, value:Any) -> intWrapper for ``curl_easy_setopt``.
method
curl_cffi.curl.Curl.version() -> bytesGet the underlying libcurl version.
method
curl_cffi.curl.Curl.ws_close(code:int=1000, message:bytes=b'') -> intClose a websocket connection.
method
curl_cffi.curl.Curl.ws_recv() -> tuple[bytes, CurlWsFrame]Receive a frame from a websocket connection.
method
curl_cffi.curl.Curl.ws_send(payload:bytes | memoryview, flags:CurlWsFlag | int=CurlWsFlag.BINARY) -> intSend data to a websocket connection.
class
curl_cffi.curl.CurlErrorBase exception for curl_cffi package
class
curl_cffi.curl.CurlMimeWrapper for the ``curl_mime_`` API.
method
curl_cffi.curl.CurlMime.addpart(name:str, *content_type:str | None=None, *filename:str | None=None, *local_path:str | bytes | Path | None=None, *data:bytes | None=None) -> NoneAdd a mime part for a mutlipart html form.
method
curl_cffi.curl.CurlMime.attach(curl:Curl | None=None) -> NoneAttach the mime instance to a curl instance.
method
curl_cffi.curl.CurlMime.close() -> NoneClose the mime instance and underlying files.
func
curl_cffi.curl.bytes_to_hex(b:bytes, uppercase:bool=False) -> strConvert a bytes object to a space-separated hex string, e.g.
func
curl_cffi.curl.debug_function(curl, type_:int, data, size:int, clientp) -> intffi callback for curl debug info
func
curl_cffi.curl.slist_to_list(head) -> list[bytes]Converts curl slist to a python list.
class
curl_cffi.fingerprints.FingerprintUpdateErrorRaised when fingerprint update fails.
func
curl_cffi.fingerprints.get_fingerprint(target:str) -> FingerprintReturn a deep-copied fingerprint that callers can edit safely.
method
curl_cffi.requests.cache.CacheBackend.should_cache_request(request:Request, *stream:bool=False, *content_callback:Any=None) -> boolXXX: streamed content is not cached.
class
curl_cffi.requests.cookies.CookiesHTTP Cookies, as a mutable mapping.
method
curl_cffi.requests.cookies.Cookies.clear(domain:Optional[str]=None, path:Optional[str]=None) -> NoneDelete all cookies.
method
curl_cffi.requests.cookies.Cookies.delete(name:str, domain:Optional[str]=None, path:Optional[str]=None) -> NoneDelete a cookie by name.
method
curl_cffi.requests.cookies.Cookies.get(name:str, default:Optional[str]=None, domain:Optional[str]=None, path:Optional[str]=None) -> Optional[str]Get a cookie by name.
method
curl_cffi.requests.cookies.Cookies.set(name:str, value:str, domain:str='', path:str='/', secure=False) -> NoneSet a cookie value by name.
class
curl_cffi.requests.exceptions.CertificateVerifyErrorRaised when certificate validated has failed
class
curl_cffi.requests.exceptions.ConnectionErrorA Connection error occurred.
class
curl_cffi.requests.exceptions.ContentDecodingErrorFailed to decode response content.
class
curl_cffi.requests.exceptions.CookieConflictSame cookie exists for different domains.
class
curl_cffi.requests.exceptions.DNSErrorCould not resolve
class
curl_cffi.requests.exceptions.HTTPErrorAn HTTP error occurred.
class
curl_cffi.requests.exceptions.ImpersonateErrorThe impersonate config was wrong or impersonate failed.
class
curl_cffi.requests.exceptions.IncompleteReadIncomplete read of content
class
curl_cffi.requests.exceptions.InterfaceErrorA specified outgoing interface could not be used.
class
curl_cffi.requests.exceptions.InvalidHeaderThe header value provided was somehow invalid.
class
curl_cffi.requests.exceptions.InvalidJSONErrorA JSON error occurred.
class
curl_cffi.requests.exceptions.InvalidProxyURLThe proxy URL provided is invalid.
class
curl_cffi.requests.exceptions.InvalidURLThe URL provided was somehow invalid.
class
curl_cffi.requests.exceptions.JSONDecodeErrorCouldn't decode the text into json.
class
curl_cffi.requests.exceptions.MissingSchemaThe URL scheme (e.g.
class
curl_cffi.requests.exceptions.ProxyErrorA proxy error occurred.
class
curl_cffi.requests.exceptions.RequestExceptionBase exception for curl_cffi.requests package
class
curl_cffi.requests.exceptions.RequestsWarningBase warning for Requests.
class
curl_cffi.requests.exceptions.RetryErrorCustom retries logic failed.
class
curl_cffi.requests.exceptions.SSLErrorAn SSL error occurred.
class
curl_cffi.requests.exceptions.SessionClosedThe session has already been closed.
class
curl_cffi.requests.exceptions.StreamConsumedErrorThe content for this response was already consumed.
class
curl_cffi.requests.exceptions.TimeoutThe request timed out.
class
curl_cffi.requests.exceptions.TooManyRedirectsToo many redirects.
class
curl_cffi.requests.exceptions.URLRequiredA valid URL is required to make a request.
class
curl_cffi.requests.headers.HeadersHTTP headers, as a case-insensitive multi-dict.
method
curl_cffi.requests.headers.Headers.get(key:str, default:Any=None) -> AnyReturn a header value.
method
curl_cffi.requests.headers.Headers.get_list(key:str, split_commas:bool=False) -> list[Optional[str]]Return a list of all header values for a given key.
method
curl_cffi.requests.headers.Headers.items() -> ItemsView[str, Optional[str]]Return `(key, value)` items of headers.
class
curl_cffi.requests.models.RequestRepresenting a sent request.
class
curl_cffi.requests.models.ResponseContains information the server sends.
method
curl_cffi.requests.models.Response.acontent() -> byteswait and read the streaming content in one bytes object.
method
curl_cffi.requests.models.Response.atext() -> strReturn a decoded string.
method
curl_cffi.requests.models.Response.charset() -> strAlias for encoding.
method
curl_cffi.requests.models.Response.is_redirect() -> boolWhether this response is a well-formed redirect.
func
curl_cffi.requests.request(method:HttpMethod, url:str, thread:Optional[ThreadType]=None, curl_options:Optional[dict]=None, debug:Optional[bool]=None, **kwargs:Unpack[RequestParams]) -> ResponseSend an http request.
method
curl_cffi.requests.session.AsyncSession.close() -> NoneClose the session.
method
curl_cffi.requests.session.AsyncSession.loop() -> asyncio.AbstractEventLoopReturns a reference to event loop.
class
curl_cffi.requests.session.SessionA request session, cookies and connections will be reused.
method
curl_cffi.requests.session.Session.close() -> NoneClose the session.
method
curl_cffi.requests.session.Session.ws_connect(url:str, on_message=None, on_error=None, on_open=None, on_close=None, **kwargs) -> WebSocketConnects to a websocket url.
class
curl_cffi.requests.utils.NotSetTypeUnique single initialized type distinct from ``None``.
func
curl_cffi.requests.utils.is_absolute_url(url:str) -> boolCheck if the provided url is an absolute url
func
curl_cffi.requests.utils.requote_uri(uri:str) -> strRe-quote the given URI.
class
curl_cffi.requests.websockets.AsyncWebSocketAn asyncio WebSocket implementation using libcurl.
method
curl_cffi.requests.websockets.AsyncWebSocket.flush(timeout:float | None=None) -> NoneWaits until all items in the send queue have been processed.
method
curl_cffi.requests.websockets.AsyncWebSocket.loop() -> asyncio.AbstractEventLoopGet a reference to the running event loop
method
curl_cffi.requests.websockets.AsyncWebSocket.ping(payload:str | bytes) -> NoneSend a ping frame.
method
curl_cffi.requests.websockets.AsyncWebSocket.recv(*timeout:float | None=None) -> tuple[bytes, int]Receive a WebSocket message.
method
curl_cffi.requests.websockets.AsyncWebSocket.recv_json(*loads:Callable[[str], T]=json_loads, *timeout:float | None=None) -> TReceive a JSON frame.
method
curl_cffi.requests.websockets.AsyncWebSocket.recv_str(*timeout:float | None=None) -> strReceive a text frame.
method
curl_cffi.requests.websockets.AsyncWebSocket.send(payload:str | bytes | bytearray | memoryview, flags:CurlWsFlag | int=CurlWsFlag.BINARY, timeout:float | None=None) -> NoneSend a WebSocket message.
method
curl_cffi.requests.websockets.AsyncWebSocket.send_binary(payload:bytes) -> NoneSend a binary frame.
method
curl_cffi.requests.websockets.AsyncWebSocket.send_bytes(payload:bytes) -> NoneSend a binary frame, alias of :meth:`send_binary`.
method
curl_cffi.requests.websockets.AsyncWebSocket.send_json(payload:object, *dumps:Callable[..., str]=json_dumps) -> NoneSend a JSON frame.
method
curl_cffi.requests.websockets.AsyncWebSocket.send_str(payload:str) -> NoneSend a text frame.
class
curl_cffi.requests.websockets.AsyncWebSocketContextHelper to enable simpler context manager usage
class
curl_cffi.requests.websockets.WebSocketA WebSocket implementation using libcurl.
method
curl_cffi.requests.websockets.WebSocket.close(code:int=WsCloseCode.OK, message:bytes=b'')Close the connection.
method
curl_cffi.requests.websockets.WebSocket.ping(payload:str | bytes) -> intSend a ping frame.
method
curl_cffi.requests.websockets.WebSocket.recv() -> tuple[bytes, int]Receive a frame as bytes.
method
curl_cffi.requests.websockets.WebSocket.recv_json(*loads:Callable[[str], T]=json_loads) -> TReceive a JSON frame.
method
curl_cffi.requests.websockets.WebSocket.recv_str() -> strReceive a text frame.
method
curl_cffi.requests.websockets.WebSocket.run_forever(url:str='', **kwargs) -> NoneRun the WebSocket forever.
method
curl_cffi.requests.websockets.WebSocket.send(payload:str | bytes, flags:CurlWsFlag=CurlWsFlag.BINARY) -> intSend a data frame.
method
curl_cffi.requests.websockets.WebSocket.send_binary(payload:bytes) -> intSend a binary frame.
method
curl_cffi.requests.websockets.WebSocket.send_json(payload:object, *dumps:Callable[..., str]=json_dumps) -> intSend a JSON frame.
method
curl_cffi.requests.websockets.WebSocket.send_str(payload:str) -> intSend a text frame.
class
curl_cffi.requests.websockets.WebSocketClosedWebSocket is already closed.
class
curl_cffi.requests.websockets.WebSocketErrorWebSocket-specific error.
class
curl_cffi.requests.websockets.WebSocketTimeoutWebSocket operation timed out.
この情報について
掲載しているシグネチャは lexiforest/curl_cffi の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。