Skip to main content

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


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.3.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

metafile_sdk-0.3.3-py3-none-any.whl (52.2 kB view details)

Uploaded Python 3

File details

Details for the file metafile_sdk-0.3.3.tar.gz.

File metadata

  • Download URL: metafile_sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for metafile_sdk-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e5dbfc189ef7a8a080db71179bdd184abe59a2ef565984350e14ffb6d84beb67
MD5 4c234c071825180dc573c6ec64b1a99d
BLAKE2b-256 b0ec332ec37548f1fdfe860207768def91a6d313a356e599fef2de75684977b1

See more details on using hashes here.

File details

Details for the file metafile_sdk-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for metafile_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87bebe43aebe9a94834e62c9726fe396fbf332818a45ba9e82cd958ea1fc2dca
MD5 c362569abd199fa4edcac6f5c9045cac
BLAKE2b-256 0809147f081e5e697334d11571d412f737f93d7a89f6da709183eb30eda6867c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page