Skip to content

Commit

Permalink
Fix shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
Shutgun committed Jan 27, 2023
1 parent 769b7c1 commit bf5008b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions devolo_plc_api/clients/protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,24 @@ async def _async_post(self, sub_url: str, content: bytes, timeout: float = TIMEO
self._logger.debug("Posting to %s", url)
return await self._async_request("POST", url, content, timeout)

async def _async_request(self, type: str, url: str, content: bytes | None, timeout: float = TIMEOUT) -> Response:
async def _async_request(self, method: str, url: str, content: bytes | None, timeout: float = TIMEOUT) -> Response:
"""Request data asynchronously."""
try:
response = await self._session.request(
type, url, auth=DigestAuth(self._user, self.password), content=content, timeout=timeout
method,
url,
auth=DigestAuth(self._user, self.password),
content=content,
timeout=timeout,
)
if response.status_code == HTTPStatus.UNAUTHORIZED:
self.password = hashlib.sha256(self.password.encode("utf-8")).hexdigest()
response = await self._session.request(
type, url, auth=DigestAuth(self._user, self.password), content=content, timeout=timeout
method,
url,
auth=DigestAuth(self._user, self.password),
content=content,
timeout=timeout,
)
response.raise_for_status()
except HTTPStatusError as e:
Expand Down

0 comments on commit bf5008b

Please sign in to comment.