Merge "Add an urlopen exception for ImcompleteRead error."

This commit is contained in:
Zuul 2020-04-24 05:13:22 +00:00 committed by Gerrit Code Review
commit 8cf631df18
1 changed files with 7 additions and 1 deletions

View File

@ -88,7 +88,13 @@ def get_wheels(url):
resp = urllib2.urlopen(r, context=ssl._create_unverified_context())
else:
resp = urllib2.urlopen(r)
return resp.read()
#Using urllib2.request.urlopen() from python3 will face the IncompleteRead and then system report connect refused.
#To avoid this problem, add an exception to ensure that all packages will be transmitted. before link down.
try:
buf = resp.read()
except Exception as e:
buf = e.partial
return buf
def parse_image(full_image):
slash_occurrences = len(re.findall('/',full_image))