Skip to content

Commit a79ff32

Browse files
authored
Merge pull request #784 from fronzbot/dev
0.22.1
2 parents cbafd75 + fe7bf21 commit a79ff32

28 files changed

+529
-310
lines changed

.github/stale.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
coverage:
1111
runs-on: ${{ matrix.platform }}
1212
strategy:
13-
max-parallel: 4
13+
max-parallel: 1
1414
matrix:
1515
platform:
1616
- ubuntu-latest
17-
python-version: [3.9]
17+
python-version: ['3.9']
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v2
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Set up Python
18-
uses: actions/setup-python@v1
18+
uses: actions/setup-python@v4
1919
with:
20-
python-version: '3.8'
20+
python-version: '3.9'
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
24+
pip install twine build
2525
- name: Build and publish
2626
env:
2727
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2828
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2929
run: |
30-
python setup.py bdist_wheel
30+
python -m build
3131
twine upload dist/*

.github/workflows/stale.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2+
#
3+
# You can adjust the behavior by modifying this file.
4+
# For more information, see:
5+
# https://github.com/actions/stale
6+
name: Stale
7+
8+
on:
9+
schedule:
10+
- cron: '13 * * * *'
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
19+
steps:
20+
- name: stale-issues
21+
uses: actions/stale@v5
22+
with:
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
days-before-stale: 60
25+
days-before-close: 7
26+
days-before-pr-stale: -1
27+
days-before-pr-close: -1
28+
remove-stale-when-updated: true
29+
stale-issue-label: "stale"
30+
exempt-issue-labels: "no-stale,help-wanted,priority"
31+
stale-issue-message: >
32+
There hasn't been any activity on this issue recently.
33+
Please make sure to update to the latest blinkpy version and
34+
check if that solves the issue. Let us know if that works for you by
35+
adding a comment 👍
36+
37+
This issue has now been marked as stale and will be closed if no
38+
further activity occurs. Thank you for your contributions.
39+
- name: stale-pulls
40+
uses: actions/stale@v5
41+
with:
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
days-before-stale: 90
44+
days-before-close: 7
45+
days-before-issue-stale: -1
46+
days-before-issue-close: -1
47+
remove-stale-when-updated: true
48+
stale-issue-label: "stale"
49+
exempt-issue-labels: "no-stale"
50+
stale-pr-message: >
51+
There hasn't been any activity on this pull request recently. This
52+
pull request has been automatically marked as stale because of that
53+
and will be closed if no further activity occurs within 7 days.
54+
55+
Thank you for your contributions.

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
pip install -r requirements.txt
2929
pip install -r requirements_test.txt
3030
pip install tox
31-
- name: Test
31+
- name: Tests
3232
run: |
3333
tox -r

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Pipfile
1919
Pipfile.lock
2020
blink.json
2121
blinktest.py
22+
.vscode/*

.pre-commit-config.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

CHANGES.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ Changelog
44

55
A list of changes between each release
66

7+
0.22.1 (2023-10-13)
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
**Bugfixes**
11+
12+
- Fix night vision toggling for older devices (owl) (`@cocasema #756 <https://github.com/fronzbot/blinkpy/pull/756>`__)
13+
- Add missing await to blinkapp.py (`@mkmer #768 <https://github.com/fronzbot/blinkpy/pull/768>`__)
14+
- Add check command to POST commands (`@mkmer #772 <https://github.com/fronzbot/blinkpy/pull/772>`__)
15+
- Fix blinkapp session call (`@mkmer #783 <https://github.com/fronzbot/blinkpy/pull/783>`__)
16+
17+
**Other Changes**
18+
19+
- Cleanup readme, add breaking change warning
20+
- Migrate to puproject.toml + ruff
21+
- Bump ruff to 0.0.292
22+
- Bump black to 23.9.1
23+
- Bump coverage to 7.3.2
24+
- Bump build to 1.0.3
25+
- Bump pytest to 7.4.2
26+
- Bump pytest-timeout to 2.2.0
27+
- Fix 'stale' github action
28+
729
0.22.0 (2023-08-16)
830
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
931

README.rst

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Like the library? Consider buying me a cup of coffee!
66

77
`Buy me a Coffee! <https://buymeacoffee.com/kevinfronczak>`__
88

9+
**BREAKING CHANGE WARNING:**
10+
As of ``0.22.0`` the library uses asyncio which will break any user scripts used prior to this version. Please see the updated examples below and the ``blinkapp.py`` or ``blinksync.py`` examples in the ``blinkapp/`` directory for examples on how to migrate.
11+
912
**Disclaimer:**
1013
Published under the MIT license - See LICENSE file for more details.
1114

@@ -47,11 +50,17 @@ Quick Start
4750
The simplest way to use this package from a terminal is to call ``await Blink.start()`` which will prompt for your Blink username and password and then log you in. In addition, http requests are throttled internally via use of the ``Blink.refresh_rate`` variable, which can be set at initialization and defaults to 30 seconds.
4851

4952
.. code:: python
50-
53+
54+
import asyncio
55+
from aiohttp import ClientSession
5156
from blinkpy.blinkpy import Blink
5257
53-
blink = Blink()
54-
await blink.start()
58+
async def start():
59+
blink = Blink(session=ClientSession())
60+
await blink.start()
61+
return blink
62+
63+
blink = asyncio.run(start())
5564
5665
5766
This flow will prompt you for your username and password. Once entered, if you likely will need to send a 2FA key to the blink servers (this pin is sent to your email address). When you receive this pin, enter at the prompt and the Blink library will proceed with setup.
@@ -62,14 +71,20 @@ In some cases, having an interactive command-line session is not desired. In th
6271

6372
.. code:: python
6473
74+
import asyncio
75+
from aiohttp import ClientSession
6576
from blinkpy.blinkpy import Blink
6677
from blinkpy.auth import Auth
6778
68-
blink = Blink()
69-
# Can set no_prompt when initializing auth handler
70-
auth = Auth({"username": <your username>, "password": <your password>}, no_prompt=True)
71-
blink.auth = auth
72-
await blink.start()
79+
async def start():
80+
blink = Blink(session=ClientSession())
81+
# Can set no_prompt when initializing auth handler
82+
auth = Auth({"username": <your username>, "password": <your password>}, no_prompt=True)
83+
blink.auth = auth
84+
await blink.start()
85+
return blink
86+
87+
blink = asyncio.run(start())
7388
7489
7590
Since you will not be prompted for any 2FA pin, you must call the ``blink.auth.send_auth_key`` function. There are two required parameters: the ``blink`` object as well as the ``key`` you received from Blink for 2FA:
@@ -86,14 +101,20 @@ Other use cases may involved loading credentials from a file. This file must be
86101

87102
.. code:: python
88103
104+
import asyncio
105+
from aiohttp import ClientSession
89106
from blinkpy.blinkpy import Blink
90107
from blinkpy.auth import Auth
91108
from blinkpy.helpers.util import json_load
92109
93-
blink = Blink()
94-
auth = Auth(await json_load("<File Location>"))
95-
blink.auth = auth
96-
await blink.start()
110+
async def start():
111+
blink = Blink()
112+
auth = Auth(await json_load("<File Location>"))
113+
blink.auth = auth
114+
await blink.start()
115+
return blink
116+
117+
blink = asyncio.run(start())
97118
98119
99120
Saving credentials

blinkapp/blinkapp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async def download_videos(blink, save_dir="/media"):
2424
async def start(session: ClientSession):
2525
"""Startup blink app."""
2626
blink = Blink(session=session)
27-
blink.auth = Auth(await json_load(CREDFILE))
27+
blink.auth = Auth(await json_load(CREDFILE), session=session)
2828
await blink.start()
2929
return blink
3030

@@ -34,7 +34,7 @@ async def main():
3434
session = ClientSession()
3535
blink = await start(session)
3636
await download_videos(blink)
37-
blink.save(CREDFILE)
37+
await blink.save(CREDFILE)
3838
await session.close()
3939

4040

0 commit comments

Comments
 (0)