-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f22e267
commit 7aa3263
Showing
6 changed files
with
107 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: build | ||
|
||
on: push | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.9 | ||
- name: Install requirements | ||
run: pip install --upgrade . build twine | ||
- name: Run unit tests | ||
run: python -m pytest --asyncio-mode=auto | ||
- name: Build | ||
run: python -m build | ||
- name: Publish distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
# Bold Smart Lock Python Package | ||
|
||
This package implements the Bold Smart Lock API to authenticate and unlock a Bold smart lock. Usage of this API requires a Bold Connect. | ||
|
||
## Installation | ||
To install dependencies during development run `pip3 install .` from the project directory. | ||
|
||
To install dependencies during development run `pip install .` from the project directory. | ||
|
||
## Run tests | ||
Run `python3 -m pytest --asyncio-mode=auto` from the project directory. | ||
|
||
Run `python -m pytest --asyncio-mode=auto` from the project directory. | ||
|
||
## Usage | ||
|
||
|
@@ -16,32 +19,32 @@ import aiohttp | |
from bold_smart_lock.bold_smart_lock import BoldSmartLock | ||
|
||
async def main(): | ||
async with aiohttp.ClientSession() as session: | ||
bold = BoldSmartLock(session) | ||
async with aiohttp.ClientSession() as session: | ||
bold = BoldSmartLock(session) | ||
|
||
# Request a validation code for the account e-mail address | ||
verify_email_response = await bold.verify_email("[email protected]"); | ||
print(verify_email_response) | ||
# Request a validation id and validation code for the account e-mail address | ||
request_validation_id_response = await bold.request_validation_id("[email protected]"); | ||
print(request_validation_id_response) | ||
|
||
# Authenticate with email, password, validation code (from email) and validation id (from output) | ||
authenticate_response = await bold.authenticate("[email protected]", "password", "01234", "00000000-0000-0000-0000-000000000000"); | ||
print(authenticate_response) | ||
# Authenticate with email, password, validation code (from email) and validation id (from output) | ||
authenticate_response = await bold.authenticate("[email protected]", "password", "01234", "00000000-0000-0000-0000-000000000000"); | ||
print(authenticate_response) | ||
|
||
# E.g. for testing purpose you can set a token | ||
token = "00000000-0000-0000-0000-000000000000" | ||
bold.set_token(token) | ||
# E.g. for testing purpose you can set a token | ||
token = "00000000-0000-0000-0000-000000000000" | ||
bold.set_token(token) | ||
|
||
# Get the devices and device permissions | ||
get_device_permissions_response = await bold.get_device_permissions() | ||
print(get_device_permissions_response) | ||
# Get the devices and device permissions | ||
get_device_permissions_response = await bold.get_device_permissions() | ||
print(get_device_permissions_response) | ||
|
||
# Active the smart lock by device id | ||
remote_activation_response = await bold.remote_activation(12345) | ||
print(remote_activation_response) | ||
# Active the smart lock by device id | ||
remote_activation_response = await bold.remote_activation(12345) | ||
print(remote_activation_response) | ||
|
||
# Re-login / update token | ||
relogin_response = await bold.re_login() | ||
print(relogin_response) | ||
# Re-login / update token | ||
relogin_response = await bold.re_login() | ||
print(relogin_response) | ||
|
||
asyncio.run(main()) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters