File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1212import sys
1313import tarfile
1414import time
15+ from urllib .error import URLError
1516from urllib .request import Request , urlopen
1617
1718BUNDLE_URL = 'https://download.calibre-ebook.com/ci/kitty/{}-64.tar.xz'
@@ -187,8 +188,13 @@ def install_grype() -> str:
187188 rq = Request ('https://api.github.com/repos/anchore/grype/releases/latest' , headers = {
188189 'Accept' : 'application/vnd.github.v3+json' ,
189190 })
190- with urlopen (rq ) as f :
191- m = json .loads (f .read ())
191+ try :
192+ with urlopen (rq ) as f :
193+ m = json .loads (f .read ())
194+ except URLError :
195+ time .sleep (1 )
196+ with urlopen (rq ) as f :
197+ m = json .loads (f .read ())
192198 for asset in m ['assets' ]:
193199 if asset ['name' ].endswith ('_linux_amd64.tar.gz' ):
194200 url = asset ['browser_download_url' ]
You can’t perform that action at this time.
0 commit comments