From 79ab25aa7d048101cf3d8301fb30c6dbaf1c6273 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 11 Apr 2021 14:37:57 +0200 Subject: [PATCH] pygithub: try to retry requests We get a lot of errors recently --- .mypy.ini | 2 ++ autobuild.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 .mypy.ini diff --git a/.mypy.ini b/.mypy.ini new file mode 100644 index 0000000..2aeb7aa --- /dev/null +++ b/.mypy.ini @@ -0,0 +1,2 @@ +[mypy] +ignore_missing_imports = True \ No newline at end of file diff --git a/autobuild.py b/autobuild.py index e1eef79..1d45b43 100755 --- a/autobuild.py +++ b/autobuild.py @@ -19,6 +19,7 @@ import traceback from tabulate import tabulate from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager +from urllib3.util import Retry import requests import shlex import time @@ -1135,6 +1136,7 @@ def get_github(optional_credentials: bool = False) -> Github: has_creds = bool(kwargs) # 100 is the maximum allowed kwargs['per_page'] = 100 + kwargs['retry'] = Retry(total=3, backoff_factor=1) gh = Github(**kwargs) if not has_creds and optional_credentials: print(f"[Warning] Rate limit status: {gh.get_rate_limit().core}", file=sys.stderr)