From dd7bc68929ff4423e36bed9ef16a2e0b68e19505 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 18 May 2023 07:34:40 +0000 Subject: automatic import of python-metafile-sdk --- python-metafile-sdk.spec | 304 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 python-metafile-sdk.spec (limited to 'python-metafile-sdk.spec') diff --git a/python-metafile-sdk.spec b/python-metafile-sdk.spec new file mode 100644 index 0000000..b12bab1 --- /dev/null +++ b/python-metafile-sdk.spec @@ -0,0 +1,304 @@ +%global _empty_manifest_terminate_build 0 +Name: python-metafile-sdk +Version: 0.3.1 +Release: 1 +Summary: Metafile Python SDK +License: MIT License +URL: https://github.com/gitzhou/metafile-sdk-py +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/da/e4/2e3fdb85df4ba5522d4e02626e0e0b9c85b0ea18bd4bcde8305b0fd0d61e/metafile_sdk-0.3.1.tar.gz +BuildArch: noarch + +Requires: python3-bitsv +Requires: python3-pydantic +Requires: python3-requests +Requires: python3-SQLAlchemy + +%description +# Metafile Python SDK + +## SDK demo + +```python +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() +``` + + + +%package -n python3-metafile-sdk +Summary: Metafile Python SDK +Provides: python-metafile-sdk +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-metafile-sdk +# Metafile Python SDK + +## SDK demo + +```python +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() +``` + + + +%package help +Summary: Development documents and examples for metafile-sdk +Provides: python3-metafile-sdk-doc +%description help +# Metafile Python SDK + +## SDK demo + +```python +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() +``` + + + +%prep +%autosetup -n metafile-sdk-0.3.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-metafile-sdk -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot - 0.3.1-1 +- Package Spec generated -- cgit v1.2.3