Package: remme
Remme Python ClientAn open source Python integration library for REMChain, simplifying the access
and interaction with Remme nodes both public or permissioned.How to use1. Install Remme protocol2. Install dependencies3. Install libraryExamplesRemme clientTokensCertificatesSubscribing to EventsContributingLicenseHow to use1. Install Remme protocolInstall and run Remme protocol with required RPC API methods enabled.You can check out how to do that atRemme core repo.2. Install dependencies:Before installing the library, make sure that all the dependencies listed are installed.Required by one of the requirementssystem packages list$sudoapt-getupdate
$sudoapt-getinstallpython3-devpython3-setuptools-y
$sudoapt-getinstallbuild-essentialautomakelibtoolpkg-configlibffi-dev-y3. Install libraryInstall the latest version of library to your Python project from terminal usingpip:$pip3installremmeExamplesRemme clientfromremmeimportRemmefromremme.models.account.account_typeimportAccountTypeaccount_config={'private_key_hex':'f4f551c178104595ff184f1786ddb2bfdc74b24562611edcab90d4729fb4bab8','account_type':AccountType.USER,}network_config={'node_address':'localhost:8080','ssl_mode':False,}remme=Remme(account_config=account_config,network_config=network_config)Tokensremme_address='1120077f88b0b798347b3f52751bb99fa8cabaf926c5a1dad2d975d7b966a85b3a9c21'balance=awaitremme.token.get_balance(address=remme_address)print(f'Account —{remme_address}, balance —{balance}REM.')transaction_result=awaitremme.token.transfer(address_to=remme_address,amount=10)print(f'Transaction batch id:{transaction_result.batch_id}')Certificatescertificate_transaction_result=awaitremme.certificate.create_and_store(common_name='user_name',email='user@email.com',name='John',surname='Smith',country_name='US',validity=360,serial=str(datetime.now()))certificate=certificate_transaction_result.certificatewhileTrue:try:info=awaitremme.certificate.get_info(certificate)print(f'Info:{info.data}')certificate_status=awaitremme.certificate.check(certificate)print(f'Certificate is valid:{certificate_status}')breakexceptRpcGenericServerDefinedError:continueSubscribing to EventsRemmeEvents is enums which describe all available events.fromremme.models.websocket.eventsimportRemmeEventsevents=awaitremme.events.subscribe(events=RemmeEvents.AtomicSwap.value)asyncforresponseinevents:print("connected")ifisinstance(response,dict):print(response)else:print(f'State:{response.state}')print(f'Sender address:{response.sender_address}')print(f'Receiver address:{response.receiver_address}')print(f'Amount:{response.amount}')Also we give a possibility to start listen events from previous block by providing last known block id.fromremme.models.websocket.eventsimportRemmeEventsevents=awaitremme.events.subscribe(events=RemmeEvents.AtomicSwap.value,last_known_block_id='db19f0e3b3f001670bebc814e238df48cef059f3f0668f57702ba9ff0c4b8ec45c7298f08b4c2fa67602da27a84b3df5dc78ce0f7774b3d3ae094caeeb9cbc82',)asyncforresponseinevents:print("connected")ifisinstance(response,dict):print(response)else:print(f'State:{response.state}')print(f'Sender address:{response.sender_address}')print(f'Receiver address:{response.receiver_address}')print(f'Amount:{response.amount}')Unsubscribe from listening events.awaitremme.events.unsubscribe(events=RemmeEvents.AtomicSwap.value)ContributingClone the project and install requirements:$gitclonegit@github.com:Remmeauth/remme-client-python.git&&cdremme-client-python
$pip3install-rrequirements.txt
$pip3install-rrequirements-dev.txtIf you prefer working with theDocker, follow:$gitclonegit@github.com:Remmeauth/remme-client-python.git&&cdremme-client-python
$dockerbuild-tremme-client-python.-fDockerfile
$dockerrun-v$PWD:/remme-client-python--nameremme-client-pythonremme-client-pythonEnter the container bash, checkPythonversion and run tests:$dockerexec-itremme-client-pythonbash
$root@98247c92404d:/remme-client-python#python--version
$root@98247c92404d:/remme-client-python#pytest-vvtestsClean container and images with the following command:$dockerrm$(dockerps-a-q)-f
$dockerrmi$(dockerimages-q)-fLicenseRemme software and documentation are licensed underApache License Version 2.0 <LICENSE>.