latch sdk-pyhton
Project description
LATCH PYTHON SDK
#### PREREQUISITES ####
-
Python.
-
Read API documentation (https://latch.telefonica.com/www/developers/doc_api).
-
To get the "Application ID" and "Secret", (fundamental values for integrating Latch in any application), it’s necessary to register a developer account in Latch's website: https://latch.telefonica.com. On the upper right side, click on "Developer area"
USING THE SDK IN PYTHON
- Install "latch-sdk-telefonica"
pip install latch-sdk-telefonica
- Import "latch" module.
import latch
- Create a Latch object with the "Application ID" and "Secret" previously obtained.
api = latch.Latch("APP_ID_HERE", "SECRET_KEY_HERE")
- Optional settings:
latch.Latch.set_proxy("PROXY_HOST_HERE", port)
- Call to Latch Server. Pairing will return an account id that you should store for future api calls
response = api.pair("PAIRING_CODE_HERE")
response = api.status("ACCOUNT_ID_HERE")
response = api.unpair("ACCOUNT_ID_HERE")
- After every API call, get Latch response data and errors and handle them.
responseData = response.get_data()
responseError = response.get_error()
USING PYTHON SDK FOR WEB3 SERVICES
For using the Python SDK within an Web3 service, you must complain with the following:
- It is necessary to have a developer subscription that allows you to create web3 apps.
- You need metamask extension for Google Chrome Download metamask
- You need a wallet to operate on Polygon. You can easily create one through Metamask.
Creation of a WEB3 Latch app
Once you have your developer Latch account created, you must logging in the website.
Steps to add new web3 app in latch-website
We add a new method to pair the web3 applications, now we have two new parameters. The two additional parameters are:
- WEB3WALLET: The Ethereum-based address wallet for the user that wants to pair the service.
- WEB3SIGNATURE: A proof-of-ownership signature of a constant, in order to verify that the user owns the private key of the wallet. You can use https://etherscan.io/verifiedSignatures# to sign the following message:
- MESSAGE TO SIGN : "Latch-Web3"
- Call to Latch Server for pairing as usual, but with the newly methods:
api = latch.Latch(APP_ID, SECRET_KEY)
# PAIR
response = api.pair(pairing_code, WEB3WALLET, WEB3SIGNATURE)
You have an example of use in the file example for web3 app
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 Distribution
Hashes for latch-sdk-telefonica-2.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1fb220d6bd0d1df38a33826c059441cc7c0b9602a5110c11ddbb0947e272b2f |
|
MD5 | 8cee7288f4aa173c4da073dc10918700 |
|
BLAKE2b-256 | ae7d378ef936760c3d43632c6321d2d8d19ed3e20b8b133cc5541235ed5fe614 |
Hashes for latch_sdk_telefonica-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e67ae5b64062491fa13d0b82b203ce4aee878510da700d216fe1249ec88cd438 |
|
MD5 | a119618a3d0d823c571af9835cc7fb5d |
|
BLAKE2b-256 | dd32c9b63d2debf99056be6b9d44e5a35306862a3cff5cec4399f318c206b04a |