No project description provided
Project description
Description
JSON-RPC server based on fastapi:
Installation
pip install fastapi-jsonrpc
Usage
pip install uvicorn
import fastapi_jsonrpc as jsonrpc
from fastapi_jsonrpc import Param
app = jsonrpc.API()
api_v1 = jsonrpc.Entrypoint('/api/v1/jsonrpc')
class ValidationError(jsonrpc.BaseError):
CODE = 5000
MESSAGE = 'Validation error'
@api_v1.method(errors=[ValidationError])
def echo(
data: str = Param(..., example="123"),
) -> str:
if data == 'error':
raise ValidationError(data={'details': 'error'})
return data
app.bind_entrypoint(api_v1)
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, port=5000, debug=True, access_log=False)
Go to:
Development
Install poetry
Install dependencies
poetry updateInstall dephell
pip install dephellRegenerate setup.py
dephell deps convert
Changelog
[0.1.4] Add description to README.rst
[0.1.3] Fix README.rst
[0.1.2] Add usage example to README.rst
[0.1.1] README.rst
[0.1.0] Initial commit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi-jsonrpc-0.1.4.tar.gz
(6.8 kB
view details)
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 fastapi-jsonrpc-0.1.4.tar.gz.
File metadata
- Download URL: fastapi-jsonrpc-0.1.4.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a0aa97e018a1ab1ec3269f5c36bd0439a21a7cbab0a8960cb373713aa526c80
|
|
| MD5 |
374630b54a251e1b0c64317cdca57e56
|
|
| BLAKE2b-256 |
a125739f9853a9590f7a09311e3d464c888a8d4027e84e81a52a64c91357b03c
|
File details
Details for the file fastapi_jsonrpc-0.1.4-py3-none-any.whl.
File metadata
- Download URL: fastapi_jsonrpc-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d09497527692381670e0473b1e402fb7607b121abb491d6587995fda0b8d857b
|
|
| MD5 |
6f52708f4eff3536ca53e5cdcd61ec7a
|
|
| BLAKE2b-256 |
1732a1e83c098c85640c13749a258746eebf4bfbeddf59716f228298366d9616
|