File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class UpdateInfo(NamedTuple):
22
22
size : int | None
23
23
version : str
24
24
25
+
25
26
class ExtensionDownloader :
26
27
"""Extension downloader."""
27
28
def __init__ (
@@ -130,26 +131,27 @@ async def _check_update(
130
131
"id" : self .extension_id ,
131
132
}) + "&uc"
132
133
}
134
+ text = None
133
135
async with session .get (
134
136
self .CHROME_WEB_STORE_API_BASE ,
135
137
params = params ,
136
138
proxy = self .proxy ,
137
139
) as response :
140
+
138
141
try :
139
142
text = await response .text ()
140
143
except ClientError as e :
141
144
_logger .debug ("Failed to get update response because %s." , e )
142
- return None
143
145
except asyncio .TimeoutError :
144
146
_logger .debug ("Failed to get update response because async operation timeout." )
145
- return None
146
147
else :
147
148
if response .status != HTTPStatus .OK :
148
149
_logger .debug (
149
150
"Failed to send update check request, it returns `%s`" ,
150
151
text
151
152
)
152
- return None
153
+ if text is None :
154
+ return None
153
155
154
156
element = fromstring (text )
155
157
updatecheck = element .find ("./*/{http://www.google.com/update2/response}updatecheck" )
@@ -171,7 +173,6 @@ async def _check_update(
171
173
return None
172
174
return UpdateInfo (url , sha256 , size , version )
173
175
174
-
175
176
def _requires_download (self , version : str ) -> bool :
176
177
current_version = self ._get_current_version ()
177
178
if current_version is None :
You can’t perform that action at this time.
0 commit comments