Python package to access Universa UMI API from python.
Project description
py-umi
This is an under-construction official Python package from Universa to facilitate access to the Java library using Universa's UMI protocol.
Installation
pip install py-umi
Usage
Prerequisites
You need to have UMI installed somewhere on your system. To run, UMI requires JVM v1.8.* (or newer) to be installed, too.
UMI can be used in one of three modes:
pipe– the UMI instance is dynamically executed in a subprocess, and a pipe is used for communication.tcp– connect to an already running UMI instance via TCP socket.unix– connect to an already running UMI instance via Unix socket.
By default it expects an umi binary to be installed an reachable via the shell $PATH, and will invoke it automatically in pipe mode.
Use umi.transport.setupUMI method if you need to switch the connection method to some other.
Example
#!/usr/bin/env python3
from umi.transport import transport
from umi.types import PrivateKey, Contract, RevokePermission
if __name__ == '__main__':
# The next line is not necessary if umi is reachable via the $PATH
# transport.setupUMI('pipe', '/usr/local/bin/umi')
# To connect to an already running UMI instance you may use one of this modes:
# transport.setupUMI('tcp', host='127.0.0.1', port=12345) # IPv6 is also ok
# transport.setupUMI('unix', path='/path-to-the-socket')
print(transport.version)
private_key = PrivateKey(size=2048)
contract = Contract()
short_address = private_key.public_key.short_address
owner_role = contract.set_owner_addresses(short_address)
revoke_permission = RevokePermission(owner_role)
contract.add_permission(revoke_permission)
Docs and resources
For more information see:
License
This package is available as open source under the terms of the MIT License.
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 Distributions
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 py-umi-0.2.4.tar.gz.
File metadata
- Download URL: py-umi-0.2.4.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ab0fe3969f7c5c164d33a15f86d3e954e691daa9a7c9882f13e897d204ae55e
|
|
| MD5 |
ae369b1a1fac50cfe0773955803f82c0
|
|
| BLAKE2b-256 |
1a6f62b33497aff0432d2021e948630c5a008ea8a0365e881ce649823c94aaa8
|
File details
Details for the file py_umi-0.2.4-py3-none-any.whl.
File metadata
- Download URL: py_umi-0.2.4-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da0bb6482d6459bd3f1b3a238e82cdce604bef4bbd9ab620bd498e5610decba1
|
|
| MD5 |
df0c1217c466a01efbf97a00803bb220
|
|
| BLAKE2b-256 |
b9fb3dfb35082c2476e2655b058727b0e784c3798632e637e166f549b57fd7ff
|
File details
Details for the file py_umi-0.2.4-py2-none-any.whl.
File metadata
- Download URL: py_umi-0.2.4-py2-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b77d02a1db2dc8467d43f6de5c7917a9ce21d1fbb6df7344b2323a7faf3c0777
|
|
| MD5 |
ad0825ae11449e7bf20ac16f64242fc5
|
|
| BLAKE2b-256 |
4f36c0ad2ed5291148d9ee47060adf03101955c904e09321162ce3d500606e92
|