Metafile Python SDK
Project description
Metafile Python SDK
SDK demo
import time
from metafile_sdk import Metafile
from metafile_sdk.bitsv import PrivateKey
from metafile_sdk.api.metasv import MetasvApi
from metafile_sdk.api.sensible_query import SensibleQueryApi
# metafile protocol node of your metaid
metafile_protocol = ''
# wif that can add child nodes under your metafile protocol node
wif = ''
# path to the file
file_path = ''
def whatsonchain_demo():
metafile = Metafile()
pk: PrivateKey = PrivateKey(wif)
print(pk.address)
print(pk.get_balance())
t1 = time.time()
txid = metafile.upload_metafile_from_path(pk, metafile_protocol, file_path)
t2 = time.time()
print('main txid', txid)
print('main txid', f'https://metafile.id/download/{txid}')
print('main txid', t2 - t1)
def sensible_query_demo():
metafile = Metafile()
pk: PrivateKey = PrivateKey(wif)
# use sensible query api
sensible_query_api = SensibleQueryApi()
pk.network_api = sensible_query_api
print(pk.address)
print(pk.get_balance())
t1 = time.time()
txid = metafile.upload_metafile_from_path(pk, metafile_protocol, file_path)
t2 = time.time()
print('main txid', txid)
print('main txid', f'https://metafile.id/download/{txid}')
print('main txid', t2 - t1)
def metasv_demo():
metafile = Metafile()
pk: PrivateKey = PrivateKey(wif)
# use metasv api
metasv_api_key = ''
metasv = MetasvApi(metasv_api_key)
pk.network_api = metasv
print(pk.address)
print(pk.get_balance())
t1 = time.time()
txid = metafile.upload_metafile_from_path(pk, metafile_protocol, file_path)
t2 = time.time()
print('main txid', txid)
print('main txid', f'https://metafile.id/download/{txid}')
print('main txid', t2 - t1)
def main():
# pip install metafile-sdk
# whatsonchain_demo()
sensible_query_demo()
# metasv_demo()
if __name__ == '__main__':
main()
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
metafile_sdk-0.3.0.tar.gz
(39.3 kB
view hashes)
Built Distribution
Close
Hashes for metafile_sdk-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 418dfef2e7bedb4592db2d3ef5b6efc2838b2de3131774d528c9d493a2c99766 |
|
MD5 | 9319dc661d1d0660b831119d8045c7d3 |
|
BLAKE2b-256 | 6a278dbe92e6ad7bd6a217c6d422bb5a7ce2641c0dcf20776c3c47e992d8a3bc |