Skip to content

Commit c7c1ea8

Browse files
authored
Merge pull request fronzbot#1131 from fronzbot/dev
v0.24.1
2 parents 1aa4228 + 5c41a65 commit c7c1ea8

File tree

9 files changed

+25
-37
lines changed

9 files changed

+25
-37
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
platform:
1515
- ubuntu-latest
16-
python-version: ['3.11']
16+
python-version: ['3.12']
1717
steps:
1818
- name: Check out code from GitHub
1919
uses: actions/checkout@v3

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
max-parallel: 2
1616
matrix:
17-
python-version: ['3.9', '3.10', '3.11', '3.12']
17+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
1818

1919
steps:
2020
- uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v4
1919
with:
20-
python-version: '3.11'
20+
python-version: '3.12'
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
platform:
1616
- ubuntu-latest
17-
python-version: ['3.9', '3.10', '3.11', '3.12']
17+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
1818
steps:
1919
- name: Check out code from GitHub
2020
uses: actions/checkout@v3

README.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ 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-
129
**Disclaimer:**
1310
Published under the MIT license - See LICENSE file for more details.
1411

blinkpy/auth.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ async def login(self, login_url=LOGIN_ENDPOINT, refresh=False):
114114
try:
115115
if response.status == 200:
116116
return await response.json()
117+
if response.status == 401:
118+
_LOGGER.error(
119+
"Unable to refresh token. "
120+
"Invalid refresh token or invalid credentials."
121+
)
122+
raise UnauthorizedError
117123
if response.status == 412:
118124
raise BlinkTwoFARequiredError
119125
raise LoginError
@@ -263,23 +269,6 @@ async def query(
263269
code,
264270
reason,
265271
)
266-
except UnauthorizedError:
267-
try:
268-
if not is_retry:
269-
await self.refresh_tokens()
270-
return await self.query(
271-
url=url,
272-
data=data,
273-
headers=self.header,
274-
reqtype=reqtype,
275-
stream=stream,
276-
json_resp=json_resp,
277-
is_retry=True,
278-
timeout=timeout,
279-
)
280-
_LOGGER.error("Unable to access %s after token refresh.", url)
281-
except TokenRefreshFailed:
282-
_LOGGER.error("Unable to refresh token.")
283272
return None
284273

285274

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "blinkpy"
7-
version = "0.24.0"
7+
version = "0.24.1"
88
license = {text = "MIT"}
99
description = "A Blink camera Python Library."
1010
readme = "README.rst"
@@ -19,6 +19,8 @@ classifiers = [
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
2224
"Topic :: Home Automation",
2325
]
2426
requires-python = ">=3.9.0"

requirements_test.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
ruff==0.11.13
2-
black==24.4.2
3-
build==1.2.1
4-
coverage==7.8.2
5-
pytest==8.4.0
6-
pytest-cov==6.1.1
7-
pytest-sugar==1.0.0
1+
ruff==0.14.1
2+
black==25.9.0
3+
build==1.3.0
4+
coverage==7.10.7
5+
pytest==8.4.2
6+
pytest-cov==7.0.0
7+
pytest-sugar==1.1.1
88
pytest-timeout==2.4.0
99
restructuredtext-lint==1.4.0
1010
pygments==2.18.0

tests/test_auth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,16 @@ async def test_query_retry(self): # , mock_refresh, mock_validate):
225225
@mock.patch("blinkpy.auth.Auth.validate_response")
226226
@mock.patch("blinkpy.auth.Auth.refresh_tokens")
227227
async def test_query_retry_failed(self, mock_refresh, mock_validate):
228-
"""Check handling of failed retry request."""
228+
"""Check authorization failure is thrown."""
229229
self.auth.session = MockSession()
230230
mock_validate.side_effect = [
231231
BlinkBadResponse,
232232
UnauthorizedError,
233-
TokenRefreshFailed,
234233
]
235234
mock_refresh.return_value = True
236235
self.assertEqual(await self.auth.query(url="http://example.com"), None)
237-
self.assertEqual(await self.auth.query(url="http://example.com"), None)
236+
with self.assertRaises(UnauthorizedError):
237+
await self.auth.query(url="http://example.com")
238238

239239
@mock.patch("blinkpy.auth.Auth.validate_response")
240240
async def test_query(self, mock_validate):
@@ -250,8 +250,8 @@ async def test_query(self, mock_validate):
250250
self.assertIsNone(await self.auth.query("URL", "data", "headers", "post"))
251251

252252
mock_validate.side_effect = UnauthorizedError
253-
self.auth.refresh_tokens = mock.AsyncMock()
254-
self.assertIsNone(await self.auth.query("URL", "data", "headers", "post"))
253+
with self.assertRaises(UnauthorizedError):
254+
await self.auth.query("URL", "data", "headers", "post")
255255

256256
@mock.patch("blinkpy.auth.Auth.validate_response")
257257
@mock.patch("blinkpy.auth.Auth.validate_login")

0 commit comments

Comments
 (0)