Python wrapper for TTLock API
Project description
ttlock.io
Python wrapper for TTLock API
- Register a developer account
https://euopen.ttlock.com/register
- Log in
https://euopen.ttlock.com/login
- Create application:
https://euopen.ttlock.com/CreateApplication
- The application needs to be reviewed. After it is reviewed, all the APIs are available.
- Create a user for this application and get the access token:
$ pip install ttlockio
$ create_user YOUR_APP_CLIENT_ID YOUR_APP_CLIENT_SECRET USERNAME PASSWORD --token
--token is an optional parameter; create_user -h for usage. if not used the user will be created without an access token. You need pass the PASSWORD with max 32 chars, low case
- Return:
{'username': 'prefixed_user'}
{'access_token': 'xxx', 'uid': xxx, 'refresh_token': 'xxx', 'openid': xxx, 'scope': 'user,key,room', 'token_type': 'Bearer', 'expires_in': 7776000}
5a. Refresh the access token when required
refresh_access_token YOUR_APP_CLIENT_ID YOUR_APP_CLIENT_SECRET YOUR_REFRESH_TOKEN
- Return:
{'access_token': 'xxx', 'refresh_token': 'xxx', 'openid': xxx, 'scope': 'user,key,room', 'token_type': 'Bearer', 'expires_in': 7776000}
- Test your USER:
- Download TTLock App at your cellphones app store. Log in with your YOUR_APP_NAME_CONCAT_NEW_NAME_FOR_YOUR_USER and NEW_PASS_FOR_YOUR_USER created on step four.
- Add your TTLock gateways and locks.
- Install and Use
$ pip install ttlockio
$ python3
>>import ttlockwrapper
>>gateways = list(ttlockwrapper.TTLock(clientId='YOUR_APP_CLIENT_ID',accessToken='YOUR_ACCESS_TOKEN').get_gateway_generator())
>>print('Gateway ID and Gateway Lock quantity: {}, {}'.format(gateways[0].get('gatewayId'),gateways[0].get('lockNum')))
- Examples
- See example dir at this repo.
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
ttlockio-0.3.4.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ttlockio-0.3.4.tar.gz.
File metadata
- Download URL: ttlockio-0.3.4.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21a51469da99f8e5d0f3e372c76ec5f3957dc31f56e0300538e4dd0efd49eb93
|
|
| MD5 |
73df9b435cb3d7735a898c8bc423a477
|
|
| BLAKE2b-256 |
7767cab1ad7f25b793b9b84796b62e7a1d24560583a696091f066df0b197afc2
|
File details
Details for the file ttlockio-0.3.4-py3-none-any.whl.
File metadata
- Download URL: ttlockio-0.3.4-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aaba49e7680c854ebcd54379c0745eef6e1dbc920d7ea0e1ebb167274b33ea9
|
|
| MD5 |
56546d48885fe71ecb9d2b86709094e9
|
|
| BLAKE2b-256 |
952ad2da9c4fa0862dc263fa29fdeb5eab581f41319fc36bc8f8a10e4fc7b7cf
|