Skip to main content

aiobsonrpc

bsonrpc for asyncio.

Python 3.5+

Getting Started

Installing

pip install aiobsonrpc

Example

Server

import asyncio
import aiobsonrpc


@aiobsonrpc.service_class
class EchoService(object):
    @aiobsonrpc.aio_rpc_request
    async def echo(self, _, data):
        await asyncio.sleep(1)
        return data


async def on_connected(reader, writer):
    aiobsonrpc.JSONRpc(reader, writer, services=EchoService())


if __name__ == '__main__':
    loop = asyncio.get_event_loop()

    server = asyncio.start_server(on_connected, '0.0.0.0', 6789, loop=loop)
    loop.create_task(server)

    loop.run_forever()

Client

import asyncio
import aiobsonrpc


async def do_connect():
    reader, writer = await asyncio.open_connection('localhost', 6789, loop=loop)
    rpc = aiobsonrpc.JSONRpc(reader, writer)
    peer = rpc.get_peer_proxy(timeout=5)
    result = await peer.echo(123)
    print(result)  # 123

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(do_connect())

Metadata

Release files for aiobsonrpc 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiobsonrpc 0.0.4
File Size Uploaded Provenance Actions
aiobsonrpc-0.0.4.tar.gz 8.3 kB Without provenance Details for aiobsonrpc-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiobsonrpc 0.0.4
File Interpreter ABI Platform Actions
aiobsonrpc-0.0.4-py3-none-any.whl Python 3 none any Details for aiobsonrpc-0.0.4-py3-none-any.whl

Total release size: 20.5 kB

Release files / aiobsonrpc-0.0.4.tar.gz

Download URL aiobsonrpc-0.0.4.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e592ff652f5c421ff22ee24773432635d429c2af96026c2002c95525e7bdfc6a
BLAKE2b-256 checksum
How to use checksums
f3e464a4890f5c18d125260357306a7fb6b939ea70f13e8e249ab4db9ec95ff3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / aiobsonrpc-0.0.4-py3-none-any.whl

Download URL aiobsonrpc-0.0.4-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4c2a0051151f82aee11c9d7b6fc25fd926d1387942a4c803b3534f397f6cdae
BLAKE2b-256 checksum
How to use checksums
3f6adbfe6dd4b1c487db7460c81b241c6e2c84489c0ca4dc30b24d71534bec29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Security for aiobsonrpc 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page