No project description provided
Project description
polywrap-client
Python implementation of the polywrap client.
Usage
Configure and Instantiate
Use the polywrap-uri-resolvers
package to configure resolver and build config for the client.
from polywrap_uri_resolvers import (
FsUriResolver,
SimpleFileReader
)
from polywrap_core import Uri, ClientConfig
from polywrap_client import PolywrapClient
from polywrap_client_config_builder import PolywrapClientConfigBuilder
builder = (
PolywrapClientConfigBuilder()
.add_resolver(FsUriResolver(file_reader=SimpleFileReader()))
.set_env(Uri.from_str("ens/foo.eth"), {"foo": "bar"})
.add_interface_implementations(
Uri.from_str("ens/foo.eth"), [
Uri.from_str("ens/bar.eth"),
Uri.from_str("ens/baz.eth")
]
)
)
config = builder.build()
client = PolywrapClient(config)
Invoke
Invoke a wrapper.
uri = Uri.from_str(
'fs/<path to wrapper>' # Example uses simple math wrapper
)
args = {
"arg1": "123", # The base number
"obj": {
"prop1": "1000", # multiply the base number by this factor
},
}
result = client.invoke(uri=uri, method="method", args=args, encode_result=False)
assert result == "123000"
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
Built Distribution
Close
Hashes for polywrap_client-0.1.0a33-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ee0fe785930015fe8b6e5b1d818ca643324da674f62736ea91c9dceb4d7373 |
|
MD5 | 75df94e984ac3f0a1747eabfbdb57df5 |
|
BLAKE2b-256 | 71d38640d06202d9cb1d07c2d58c7e3172a3ab41cc2008c0b64e0dd1f27de9e3 |