Skip to content

Commit

Permalink
Make ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
arenekosreal committed Sep 20, 2024
1 parent 92e72b9 commit 2239733
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/crx_repo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class UpdateInfo(NamedTuple):
size: int | None
version: str


class ExtensionDownloader:
"""Extension downloader."""
def __init__(
Expand Down Expand Up @@ -130,26 +131,27 @@ async def _check_update(
"id": self.extension_id,
}) + "&uc"
}
text = None
async with session.get(
self.CHROME_WEB_STORE_API_BASE,
params=params,
proxy=self.proxy,
) as response:

try:
text = await response.text()
except ClientError as e:
_logger.debug("Failed to get update response because %s.", e)
return None
except asyncio.TimeoutError:
_logger.debug("Failed to get update response because async operation timeout.")
return None
else:
if response.status != HTTPStatus.OK:
_logger.debug(
"Failed to send update check request, it returns `%s`",
text
)
return None
if text is None:
return None

element = fromstring(text)
updatecheck = element.find("./*/{http://www.google.com/update2/response}updatecheck")
Expand All @@ -171,7 +173,6 @@ async def _check_update(
return None
return UpdateInfo(url, sha256, size, version)


def _requires_download(self, version: str) -> bool:
current_version = self._get_current_version()
if current_version is None:
Expand Down

0 comments on commit 2239733

Please sign in to comment.