Skip to content

Commit

Permalink
Merge pull request #784 from fronzbot/dev
Browse files Browse the repository at this point in the history
0.22.1
  • Loading branch information
fronzbot authored Oct 13, 2023
2 parents cbafd75 + fe7bf21 commit a79ff32
Show file tree
Hide file tree
Showing 28 changed files with 529 additions and 310 deletions.
31 changes: 0 additions & 31 deletions .github/stale.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
coverage:
runs-on: ${{ matrix.platform }}
strategy:
max-parallel: 4
max-parallel: 1
matrix:
platform:
- ubuntu-latest
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py bdist_wheel
python -m build
twine upload dist/*
55 changes: 55 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Stale

on:
schedule:
- cron: '13 * * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- name: stale-issues
uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 60
days-before-close: 7
days-before-pr-stale: -1
days-before-pr-close: -1
remove-stale-when-updated: true
stale-issue-label: "stale"
exempt-issue-labels: "no-stale,help-wanted,priority"
stale-issue-message: >
There hasn't been any activity on this issue recently.
Please make sure to update to the latest blinkpy version and
check if that solves the issue. Let us know if that works for you by
adding a comment 👍
This issue has now been marked as stale and will be closed if no
further activity occurs. Thank you for your contributions.
- name: stale-pulls
uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 90
days-before-close: 7
days-before-issue-stale: -1
days-before-issue-close: -1
remove-stale-when-updated: true
stale-issue-label: "stale"
exempt-issue-labels: "no-stale"
stale-pr-message: >
There hasn't been any activity on this pull request recently. This
pull request has been automatically marked as stale because of that
and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install tox
- name: Test
- name: Tests
run: |
tox -r
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Pipfile
Pipfile.lock
blink.json
blinktest.py
.vscode/*
22 changes: 0 additions & 22 deletions .pre-commit-config.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ Changelog

A list of changes between each release

0.22.1 (2023-10-13)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Bugfixes**

- Fix night vision toggling for older devices (owl) (`@cocasema #756 <https://github.com/fronzbot/blinkpy/pull/756>`__)
- Add missing await to blinkapp.py (`@mkmer #768 <https://github.com/fronzbot/blinkpy/pull/768>`__)
- Add check command to POST commands (`@mkmer #772 <https://github.com/fronzbot/blinkpy/pull/772>`__)
- Fix blinkapp session call (`@mkmer #783 <https://github.com/fronzbot/blinkpy/pull/783>`__)

**Other Changes**

- Cleanup readme, add breaking change warning
- Migrate to puproject.toml + ruff
- Bump ruff to 0.0.292
- Bump black to 23.9.1
- Bump coverage to 7.3.2
- Bump build to 1.0.3
- Bump pytest to 7.4.2
- Bump pytest-timeout to 2.2.0
- Fix 'stale' github action

0.22.0 (2023-08-16)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
45 changes: 33 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Like the library? Consider buying me a cup of coffee!

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

**BREAKING CHANGE WARNING:**
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.

**Disclaimer:**
Published under the MIT license - See LICENSE file for more details.

Expand Down Expand Up @@ -47,11 +50,17 @@ Quick Start
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.

.. code:: python
import asyncio
from aiohttp import ClientSession
from blinkpy.blinkpy import Blink
blink = Blink()
await blink.start()
async def start():
blink = Blink(session=ClientSession())
await blink.start()
return blink
blink = asyncio.run(start())
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.
Expand All @@ -62,14 +71,20 @@ In some cases, having an interactive command-line session is not desired. In th

.. code:: python
import asyncio
from aiohttp import ClientSession
from blinkpy.blinkpy import Blink
from blinkpy.auth import Auth
blink = Blink()
# Can set no_prompt when initializing auth handler
auth = Auth({"username": <your username>, "password": <your password>}, no_prompt=True)
blink.auth = auth
await blink.start()
async def start():
blink = Blink(session=ClientSession())
# Can set no_prompt when initializing auth handler
auth = Auth({"username": <your username>, "password": <your password>}, no_prompt=True)
blink.auth = auth
await blink.start()
return blink
blink = asyncio.run(start())
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:
Expand All @@ -86,14 +101,20 @@ Other use cases may involved loading credentials from a file. This file must be

.. code:: python
import asyncio
from aiohttp import ClientSession
from blinkpy.blinkpy import Blink
from blinkpy.auth import Auth
from blinkpy.helpers.util import json_load
blink = Blink()
auth = Auth(await json_load("<File Location>"))
blink.auth = auth
await blink.start()
async def start():
blink = Blink()
auth = Auth(await json_load("<File Location>"))
blink.auth = auth
await blink.start()
return blink
blink = asyncio.run(start())
Saving credentials
Expand Down
4 changes: 2 additions & 2 deletions blinkapp/blinkapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def download_videos(blink, save_dir="/media"):
async def start(session: ClientSession):
"""Startup blink app."""
blink = Blink(session=session)
blink.auth = Auth(await json_load(CREDFILE))
blink.auth = Auth(await json_load(CREDFILE), session=session)
await blink.start()
return blink

Expand All @@ -34,7 +34,7 @@ async def main():
session = ClientSession()
blink = await start(session)
await download_videos(blink)
blink.save(CREDFILE)
await blink.save(CREDFILE)
await session.close()


Expand Down
Loading

0 comments on commit a79ff32

Please sign in to comment.