Skip to main content

ttlock.io

Python wrapper for TTLock API

  1. Register a developer account
https://euopen.ttlock.com/register
  1. Log in
https://euopen.ttlock.com/login
  1. Create application:
https://euopen.ttlock.com/CreateApplication
  • The application needs to be reviewed. After it is reviewed, all the APIs are available.
  1. 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}
  1. 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.
  1. 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')))
  1. Examples
  • See example dir at this repo.

Metadata

Release files for ttlockio 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ttlockio 0.3.4
File Size Uploaded Provenance Actions
ttlockio-0.3.4.tar.gz 11.0 kB Without provenance Details for ttlockio-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ttlockio 0.3.4
File Interpreter ABI Platform Actions
ttlockio-0.3.4-py3-none-any.whl Python 3 none any Details for ttlockio-0.3.4-py3-none-any.whl

Total release size: 17.3 kB

Release files / ttlockio-0.3.4.tar.gz

Download URL ttlockio-0.3.4.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
21a51469da99f8e5d0f3e372c76ec5f3957dc31f56e0300538e4dd0efd49eb93
BLAKE2b-256 checksum
How to use checksums
7767cab1ad7f25b793b9b84796b62e7a1d24560583a696091f066df0b197afc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / ttlockio-0.3.4-py3-none-any.whl

Download URL ttlockio-0.3.4-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4aaba49e7680c854ebcd54379c0745eef6e1dbc920d7ea0e1ebb167274b33ea9
BLAKE2b-256 checksum
How to use checksums
952ad2da9c4fa0862dc263fa29fdeb5eab581f41319fc36bc8f8a10e4fc7b7cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for ttlockio 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page