Python client introduction
Python API documentation: https://tinychain.readthedocs.io/
Install the client
# on newer operating systems this command may be "pip" instead of "pip3"
pip3 install tinychainHello, World!
import tinychain as tc
# This host is available for demonstration purposes, but may be slow
# due to the volume of requests it receives.
HOST = tc.host.Host("http://demo.tinychain.net")
# This endpoint will attempt to execute resolve whatever State it receives,
# without committing any write operations.
ENDPOINT = "/transact/hypothetical"
@tc.get_op
def hello(name: tc.String):
return tc.String("Hello, {{name}}!").render(name=name)
if __name__ == "__main__":
cxt = tc.Context()
cxt.hello = hello
cxt.result = cxt.hello("World")
print(HOST.post(ENDPOINT, cxt))Last updated
Was this helpful?