You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Lapidary supports only httpx and it's rather tightly integrated with it. The tight integration makes it hard to replace the underlying http client (#77) and impossible for users to introduce any customizations.
Solution
HTTP client adapter will be a component that conceptually sits between data serializer and http client, the whole being wrapped and managed by the ClientBase instance.
Lapidary really just converts python data into HTTP method, raw headers and request body, calls HTTP client and converts status code, raw headers and response body back to python objects.
Since adapter would provide an API purely for internal Lapidary use, it wouldn't need any facility methods like post, get and so on; a single method like exchange would suffice.
classRequest(NamedTuple):
method: strheaders: list[tuple[str, str]]
content: AsyncIterator[bytes]
ssl: SSLContextclassResponse(NamedTuple):
status_code: intheaders: list[tuple[str, str]]
content: AsyncIterator[bytes]
classHTTPConnectionError(Error):passasyncdefexchange(request: Request)->Response:
"""raises: HTTPConnectionError: general error for when a HTTP response couldn't be obtained """
The text was updated successfully, but these errors were encountered:
The problem
Currently Lapidary supports only httpx and it's rather tightly integrated with it. The tight integration makes it hard to replace the underlying http client (#77) and impossible for users to introduce any customizations.
Solution
HTTP client adapter will be a component that conceptually sits between data serializer and http client, the whole being wrapped and managed by the
ClientBase
instance.Lapidary really just converts python data into HTTP method, raw headers and request body, calls HTTP client and converts status code, raw headers and response body back to python objects.
Since adapter would provide an API purely for internal Lapidary use, it wouldn't need any facility methods like
post
,get
and so on; a single method likeexchange
would suffice.The text was updated successfully, but these errors were encountered: