curlyshed 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- curlyshed/__init__.py +54 -0
- curlyshed/__main__.py +7 -0
- curlyshed/_curl.py +730 -0
- curlyshed/_stream.py +265 -0
- curlyshed/_url.py +228 -0
- curlyshed/exceptions.py +130 -0
- curlyshed/http/__init__.py +37 -0
- curlyshed/http/_client.py +511 -0
- curlyshed/http/_response.py +332 -0
- curlyshed/py.typed +0 -0
- curlyshed/requests/__init__.py +93 -0
- curlyshed/requests/adapters.py +368 -0
- curlyshed/requests/api.py +45 -0
- curlyshed/requests/auth.py +73 -0
- curlyshed/requests/cookies.py +211 -0
- curlyshed/requests/exceptions.py +193 -0
- curlyshed/requests/hooks.py +21 -0
- curlyshed/requests/models.py +593 -0
- curlyshed/requests/sessions.py +240 -0
- curlyshed/requests/status_codes.py +32 -0
- curlyshed/requests/structures.py +29 -0
- curlyshed/requests/utils.py +104 -0
- curlyshed/websocket.py +298 -0
- curlyshed-0.1.0.dist-info/METADATA +102 -0
- curlyshed-0.1.0.dist-info/RECORD +27 -0
- curlyshed-0.1.0.dist-info/WHEEL +4 -0
- curlyshed-0.1.0.dist-info/licenses/LICENSES/EUPL-1.2.txt +190 -0
curlyshed/__init__.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""curlyshed: Python on libcurl.
|
|
2
|
+
|
|
3
|
+
libcurl does the protocol work; curlyshed gives it a Python API per protocol:
|
|
4
|
+
|
|
5
|
+
from curlyshed import http
|
|
6
|
+
with http.Client() as client:
|
|
7
|
+
r = client.get("https://example.org/", params={"q": "x"})
|
|
8
|
+
|
|
9
|
+
from curlyshed import WebSocket
|
|
10
|
+
with WebSocket("wss://example.org/feed") as ws:
|
|
11
|
+
ws.send("hello")
|
|
12
|
+
|
|
13
|
+
curlyshed.http has Client and AsyncClient, curlyshed.requests is a
|
|
14
|
+
compatibility layer with the API of requests, WebSocket and AsyncWebSocket
|
|
15
|
+
speak ws:// and wss://. Shared by all: URL (libcurl's URL API),
|
|
16
|
+
ClientConfig, the exceptions, trace_logger (curl's verbose trace) and
|
|
17
|
+
libcurl_info(); `python -m curlyshed` prints what the libcurl in use brings.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from importlib import import_module
|
|
21
|
+
from types import ModuleType
|
|
22
|
+
from typing import TYPE_CHECKING
|
|
23
|
+
|
|
24
|
+
from curlyshed import exceptions, http
|
|
25
|
+
from curlyshed._curl import MIN_LIBCURL, ClientConfig, __version__, libcurl_info, trace_logger
|
|
26
|
+
from curlyshed._url import URL
|
|
27
|
+
from curlyshed.exceptions import Error, MissingFeature
|
|
28
|
+
from curlyshed.websocket import AsyncWebSocket, WebSocket
|
|
29
|
+
|
|
30
|
+
if TYPE_CHECKING:
|
|
31
|
+
from curlyshed import requests
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def __getattr__(name: str) -> ModuleType:
|
|
35
|
+
if name == "requests":
|
|
36
|
+
return import_module("curlyshed.requests")
|
|
37
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"MIN_LIBCURL",
|
|
42
|
+
"URL",
|
|
43
|
+
"AsyncWebSocket",
|
|
44
|
+
"ClientConfig",
|
|
45
|
+
"Error",
|
|
46
|
+
"MissingFeature",
|
|
47
|
+
"WebSocket",
|
|
48
|
+
"__version__",
|
|
49
|
+
"exceptions",
|
|
50
|
+
"http",
|
|
51
|
+
"libcurl_info",
|
|
52
|
+
"requests",
|
|
53
|
+
"trace_logger",
|
|
54
|
+
]
|