Skip to content

Commit ce91696

Browse files
author
ekutner
committed
Add HTTP call counter
1 parent 11e9ca4 commit ce91696

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

home_connect_async/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def error_description(self) -> str | None:
4747
def __init__(self, auth:AbstractAuth, lang:str=None):
4848
self._auth = auth
4949
self._lang = lang
50+
self._call_counter = 0
5051

5152

5253
async def _async_request(self, method, endpoint, data=None) -> ApiResponse:
@@ -56,6 +57,9 @@ async def _async_request(self, method, endpoint, data=None) -> ApiResponse:
5657
while retry:
5758
try:
5859
response = await self._auth.request(method, endpoint, self._lang, data=data)
60+
self._call_counter += 1
61+
_LOGGER.debug('HTTP %s %s (code=%d count=%d)', method, endpoint, response.status, self._call_counter)
62+
5963
if response.status == 429: # Too Many Requests
6064
wait_time = response.headers.get('Retry-After')
6165
_LOGGER.debug('HTTP Error 429 - Too Many Requests. Sleeping for %s seconds and will retry', wait_time)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'home-connect-async',
55
packages = ['home_connect_async'],
6-
version = '0.6.3',
6+
version = '0.6.4',
77
license='MIT',
88
description = 'Async SDK for BSH Home Connect API',
99
author = 'Eran Kutner',

0 commit comments

Comments
 (0)