Name | yalexs JSON |
Version |
8.10.0
JSON |
| download |
home_page | https://github.com/bdraco/yalexs |
Summary | Python API for Yale Access (formerly August) Smart Lock and Doorbell |
upload_time | 2024-10-06 01:34:41 |
maintainer | None |
docs_url | None |
author | J. Nick Koston |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# yalexs [![PyPI version](https://badge.fury.io/py/yalexs.svg)](https://badge.fury.io/py/yalexs) [![Build Status](https://github.com/bdraco/yalexs/workflows/CI/badge.svg)](https://github.com/bdraco/yalexs) [![codecov](https://codecov.io/gh/bdraco/yalexs/branch/master/graph/badge.svg)](https://codecov.io/gh/bdraco/yalexs) [![Python Versions](https://img.shields.io/pypi/pyversions/yalexs.svg)](https://pypi.python.org/pypi/yalexs/)
Python API for Yale Access (formerly August) Smart Lock and Doorbell. This is used in [Home Assistant](https://home-assistant.io) but should be generic enough that can be used elsewhere.
## Yale Access formerly August
This library is a fork of Joe Lu's excellent august library from https://github.com/snjoetw/py-august
## Classes
### Authenticator
Authenticator is responsible for all authentication related logic, this includes authentication and verifying the account belongs to the user by sending a verification code to email or phone.
#### Constructor
| Argument | Description |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api | See Api class. |
| login_method | Login method, either "phone" or "email". |
| username | If you're login_method is phone, then this is your full phone# including "+" and country code; otherwise enter your email address here. |
| password | Password. |
| install_id\* | ID that's generated when Yale Access app is installed. If not specified, Authenticator will auto-generate one. If an install_id is provisioned, then it's good to provide the provisioned install_id as you'll bypass verification process. |
| access_token_cache_file\* | Path to access_token cache file. If specified, access_token info will be cached in the file. Subsequent authentication will utilize information in the file to determine correct authentication state. |
\* means optional
#### Methods
##### authenticate
Authenticates using specified login_method, username and password.
Outcome of this method is an Authentication object. Use Authentication.state figure out authentication state. User is authenticated only if Authentication.state = AuthenticationState.AUTHENTICATED.
If an authenticated access_token is already in the access_token_cache_file, this method will return cached authentication.
##### send_verification_code
Sends a 6-digits verification code to phone or email depending on login_method.
##### validate_verification_code
Validates verification code. This method returns ValidationResult. Check the value to see if verification code is valid or not.
## Install
```bash
pip install yalexs
```
## Usage
```python
from yalexs.api import Api
from yalexs.authenticator import Authenticator, AuthenticationState
api = Api(timeout=20)
authenticator = Authenticator(api, "phone", "YOUR_USERNAME", "YOUR_PASSWORD",
access_token_cache_file="PATH_TO_ACCESS_TOKEN_CACHE_FILE")
authentication = authenticator.authenticate()
# State can be either REQUIRES_VALIDATION, BAD_PASSWORD or AUTHENTICATED
# You'll need to call different methods to finish authentication process, see below
state = authentication.state
# If AuthenticationState is BAD_PASSWORD, that means your login_method, username and password do not match
# If AuthenticationState is AUTHENTICATED, that means you're authenticated already. If you specify "access_token_cache_file", the authentication is cached in a file. Every time you try to authenticate again, it'll read from that file and if you're authenticated already, Authenticator won't call Yale Access again as you have a valid access_token
# If AuthenticationState is REQUIRES_VALIDATION, then you'll need to go through verification process
# send_verification_code() will send a code to either your phone or email depending on login_method
authenticator.send_verification_code()
# Wait for your code and pass it in to validate_verification_code()
validation_result = authenticator.validate_verification_code(123456)
# If ValidationResult is INVALID_VERIFICATION_CODE, then you'll need to either enter correct one or resend by calling send_verification_code() again
# If ValidationResult is VALIDATED, then you'll need to call authenticate() again to finish authentication process
authentication = authenticator.authenticate()
# Once you have authenticated and validated you can use the access token to make API calls
locks = api.get_locks(authentication.access_token)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/bdraco/yalexs",
"name": "yalexs",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "J. Nick Koston",
"author_email": "nick@koston.org",
"download_url": "https://files.pythonhosted.org/packages/93/d8/cfaf8e428215f0c44af93f82184a501100694d62e68939f9320d493a5a47/yalexs-8.10.0.tar.gz",
"platform": null,
"description": "# yalexs [![PyPI version](https://badge.fury.io/py/yalexs.svg)](https://badge.fury.io/py/yalexs) [![Build Status](https://github.com/bdraco/yalexs/workflows/CI/badge.svg)](https://github.com/bdraco/yalexs) [![codecov](https://codecov.io/gh/bdraco/yalexs/branch/master/graph/badge.svg)](https://codecov.io/gh/bdraco/yalexs) [![Python Versions](https://img.shields.io/pypi/pyversions/yalexs.svg)](https://pypi.python.org/pypi/yalexs/)\n\nPython API for Yale Access (formerly August) Smart Lock and Doorbell. This is used in [Home Assistant](https://home-assistant.io) but should be generic enough that can be used elsewhere.\n\n## Yale Access formerly August\n\nThis library is a fork of Joe Lu's excellent august library from https://github.com/snjoetw/py-august\n\n## Classes\n\n### Authenticator\n\nAuthenticator is responsible for all authentication related logic, this includes authentication and verifying the account belongs to the user by sending a verification code to email or phone.\n\n#### Constructor\n\n| Argument | Description |\n| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| api | See Api class. |\n| login_method | Login method, either \"phone\" or \"email\". |\n| username | If you're login_method is phone, then this is your full phone# including \"+\" and country code; otherwise enter your email address here. |\n| password | Password. |\n| install_id\\* | ID that's generated when Yale Access app is installed. If not specified, Authenticator will auto-generate one. If an install_id is provisioned, then it's good to provide the provisioned install_id as you'll bypass verification process. |\n| access_token_cache_file\\* | Path to access_token cache file. If specified, access_token info will be cached in the file. Subsequent authentication will utilize information in the file to determine correct authentication state. |\n\n\\* means optional\n\n#### Methods\n\n##### authenticate\n\nAuthenticates using specified login_method, username and password.\n\nOutcome of this method is an Authentication object. Use Authentication.state figure out authentication state. User is authenticated only if Authentication.state = AuthenticationState.AUTHENTICATED.\n\nIf an authenticated access_token is already in the access_token_cache_file, this method will return cached authentication.\n\n##### send_verification_code\n\nSends a 6-digits verification code to phone or email depending on login_method.\n\n##### validate_verification_code\n\nValidates verification code. This method returns ValidationResult. Check the value to see if verification code is valid or not.\n\n## Install\n\n```bash\npip install yalexs\n```\n\n## Usage\n\n```python\nfrom yalexs.api import Api\nfrom yalexs.authenticator import Authenticator, AuthenticationState\n\napi = Api(timeout=20)\nauthenticator = Authenticator(api, \"phone\", \"YOUR_USERNAME\", \"YOUR_PASSWORD\",\n access_token_cache_file=\"PATH_TO_ACCESS_TOKEN_CACHE_FILE\")\n\nauthentication = authenticator.authenticate()\n\n# State can be either REQUIRES_VALIDATION, BAD_PASSWORD or AUTHENTICATED\n# You'll need to call different methods to finish authentication process, see below\nstate = authentication.state\n\n# If AuthenticationState is BAD_PASSWORD, that means your login_method, username and password do not match\n\n# If AuthenticationState is AUTHENTICATED, that means you're authenticated already. If you specify \"access_token_cache_file\", the authentication is cached in a file. Every time you try to authenticate again, it'll read from that file and if you're authenticated already, Authenticator won't call Yale Access again as you have a valid access_token\n\n\n# If AuthenticationState is REQUIRES_VALIDATION, then you'll need to go through verification process\n# send_verification_code() will send a code to either your phone or email depending on login_method\nauthenticator.send_verification_code()\n# Wait for your code and pass it in to validate_verification_code()\nvalidation_result = authenticator.validate_verification_code(123456)\n# If ValidationResult is INVALID_VERIFICATION_CODE, then you'll need to either enter correct one or resend by calling send_verification_code() again\n# If ValidationResult is VALIDATED, then you'll need to call authenticate() again to finish authentication process\nauthentication = authenticator.authenticate()\n\n# Once you have authenticated and validated you can use the access token to make API calls\nlocks = api.get_locks(authentication.access_token)\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API for Yale Access (formerly August) Smart Lock and Doorbell",
"version": "8.10.0",
"project_urls": {
"Bug Tracker": "https://github.com/bdraco/yalexs/issues",
"Changelog": "https://github.com/bdraco/yalexs/blob/main/CHANGELOG.md",
"Documentation": "https://yalexs.readthedocs.io",
"Homepage": "https://github.com/bdraco/yalexs",
"Repository": "https://github.com/bdraco/yalexs"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "287b17e7ee77dde638bb1be3091cc3908b8b0cb8967cf34e176bcb9110cb6e04",
"md5": "f9fb87f7ae564518400d3208c67f09dd",
"sha256": "b2e3de8174365b2adc67b4476e55dc280752fc0a06a8d6866208852906810ff2"
},
"downloads": -1,
"filename": "yalexs-8.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9fb87f7ae564518400d3208c67f09dd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 48041,
"upload_time": "2024-10-06T01:34:39",
"upload_time_iso_8601": "2024-10-06T01:34:39.286913Z",
"url": "https://files.pythonhosted.org/packages/28/7b/17e7ee77dde638bb1be3091cc3908b8b0cb8967cf34e176bcb9110cb6e04/yalexs-8.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93d8cfaf8e428215f0c44af93f82184a501100694d62e68939f9320d493a5a47",
"md5": "d5981a621093f83bf5b5696a83e899f3",
"sha256": "32281db88d305e057c44737e082d6c99fe24ebcf05b35fe9774d8e2c45ea5809"
},
"downloads": -1,
"filename": "yalexs-8.10.0.tar.gz",
"has_sig": false,
"md5_digest": "d5981a621093f83bf5b5696a83e899f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 39141,
"upload_time": "2024-10-06T01:34:41",
"upload_time_iso_8601": "2024-10-06T01:34:41.178242Z",
"url": "https://files.pythonhosted.org/packages/93/d8/cfaf8e428215f0c44af93f82184a501100694d62e68939f9320d493a5a47/yalexs-8.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-06 01:34:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bdraco",
"github_project": "yalexs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "yalexs"
}