mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
CI: Handle more errors when connecting to the GitHub API
This commit is contained in:
parent
f371fecb34
commit
a5797efeb0
1 changed files with 4 additions and 4 deletions
8
.github/workflows/github_api_request.py
vendored
8
.github/workflows/github_api_request.py
vendored
|
|
@ -2,7 +2,7 @@ from configure_logger import configure_logger
|
|||
|
||||
from logging import getLogger
|
||||
from urllib.request import Request, urlopen
|
||||
from urllib.error import HTTPError
|
||||
from urllib.error import HTTPError, URLError
|
||||
from json import dumps, loads
|
||||
from os import environ
|
||||
from shutil import copyfileobj
|
||||
|
|
@ -33,13 +33,13 @@ def github_api_request(path, method='GET', data=None):
|
|||
try:
|
||||
response = urlopen(req)
|
||||
return response
|
||||
except HTTPError as e:
|
||||
except (HTTPError, URLError) as e:
|
||||
num_attempts += 1
|
||||
if num_attempts == 3:
|
||||
logger.warning(f'GitHub API access failed\n{e.headers}\n{e.fp.read()}')
|
||||
logger.warning(f'GitHub API access failed\n{e.reason}\n{e.headers}\n{e.fp.read()}')
|
||||
raise e
|
||||
logger.debug(f'Request attempt {num_attempts} failed, retrying')
|
||||
sleep(5)
|
||||
sleep(10)
|
||||
|
||||
def json_github_api_request(path, method='GET', data=None):
|
||||
with github_api_request(path, method, data) as response:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue