Add your description here
Project description
Overview
A client-side library that wraps server-side functions to enable RPC-style frontend API calls without hiding HTTP implementation details.
How it works:
- Import server functions decorated with FastAPI/Flask on the client side
- Call them as regular functions; the library translates calls into HTTP requests
- Handle the HTTP responses as per usual
A simple default HTTP implementation is included, but you can substitute your own with retry logic, caching, error handling, logging, etc.
# Simple GET request without parameters
greeting_message_http = wrap_backend_call(greeting_message)
response = greeting_message_http()
print(response)
# GET request with path and query parameters
get_item_http = wrap_backend_call(get_item)
response = get_item_http(item_id=42, query="test")
print(response)
# POST request with request body
create_item_http = wrap_backend_call(post_endpoint)
response = create_item_http(data=ItemData(id=1, name="A Box"))
# Example usage: POST request using a dictionary for the request body directly
response = create_item_http(data={"id": 1, "name": "Sample Item"})
print(response)
Why?
Working across HTTP boundaries introduces friction:
- Type information is lost — No type inference or validation for payloads and parameters sent from client to server
- Developers are forced to rely on out-of-band documentation — Type schema lives in OpenAPI/Swagger docs, not visible in your editor.
Benefits
- Type safety in the editor — Full type information available for IDE autocomplete and validation
- Endpoint schema visibility — Query params, path params, request body, headers, cookies are all immediately apparent in your code
- Docstring availability — Server function docstrings show up in the client IDE
- Code Generation not required — Additional tooling or auto-generated code Changes to server signatures are immediately caught on the client side.
Limitations
- Python-only — Works for a frontend/backend stack built in python
- Server code must be imported — Client needs access to server function definitions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file http_clientlib-0.1.1.tar.gz.
File metadata
- Download URL: http_clientlib-0.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
042436a4c637c9793d8d49d9a0db745ff7d0ac5774076b13d08ade0d2ad639a2
|
|
| MD5 |
0751c891fd94e0028658eb51c314b19c
|
|
| BLAKE2b-256 |
147f4f6a878834515bbffd1f5ae19440dc0eb6d9cc7bc18773d972aa22cb1444
|
File details
Details for the file http_clientlib-0.1.1-py3-none-any.whl.
File metadata
- Download URL: http_clientlib-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e66537811c61dc4aac0bd3573cc73b6a215c0f5609689d6b7c2fe5f9fe965dd9
|
|
| MD5 |
a0fe6a26cf295fdd6ed8851f7fbb36f7
|
|
| BLAKE2b-256 |
eeaa43c96b037deac2e5ba35fcb1048880fc1e6cc08dbd6d85139ba72ac72918
|