Skip to content

Commit 6adb833

Browse files
committed
use timeout variable in a few more places
1 parent 27e456f commit 6adb833

4 files changed

+10
-7
lines changed

adabot/circuitpython_libraries.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import github as pygithub
1818
import requests
1919

20-
from adabot import github_requests as gh_reqs
20+
from adabot import github_requests as gh_reqs, REQUESTS_TIMEOUT
2121
from adabot import pypi_requests as pypi
2222
from adabot.lib import circuitpython_library_validators as cirpy_lib_vals
2323
from adabot.lib import common_funcs
@@ -224,7 +224,7 @@ def run_library_checks(validators, kw_args, error_depth):
224224
resp = requests.get(
225225
"https://raw.githubusercontent.com/adafruit/"
226226
"CircuitPython_Community_Bundle/main/.gitmodules",
227-
timeout=30,
227+
timeout=REQUESTS_TIMEOUT,
228228
)
229229
community_bundle_submodules = resp.text
230230
community_library_count = community_bundle_submodules.count("submodule")

adabot/circuitpython_library_patches.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import sh
1414
from sh.contrib import git
1515

16+
from adabot import REQUESTS_TIMEOUT
1617
from adabot.lib import common_funcs
1718

1819

@@ -100,7 +101,8 @@ def get_patches(run_local):
100101
return_list = []
101102
if not run_local:
102103
contents = requests.get(
103-
"https://api.github.com/repos/adafruit/adabot/contents/patches"
104+
"https://api.github.com/repos/adafruit/adabot/contents/patches",
105+
timeout=REQUESTS_TIMEOUT
104106
)
105107
if contents.ok:
106108
for patch in contents.json():

adabot/lib/circuitpython_library_validators.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,8 @@ def validate_readthedocs(self, repo):
892892
return []
893893
if not self.rtd_subprojects:
894894
rtd_response = requests.get(
895-
"https://readthedocs.org/api/v2/project/74557/subprojects/", timeout=15
895+
"https://readthedocs.org/api/v2/project/74557/subprojects/",
896+
timeout=REQUESTS_TIMEOUT,
896897
)
897898
if not rtd_response.ok:
898899
return [ERROR_RTD_SUBPROJECT_FAILED]
@@ -985,7 +986,7 @@ def validate_core_driver_page(self, repo):
985986
"https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/"
986987
"main/docs/drivers.rst"
987988
),
988-
timeout=15,
989+
timeout=REQUESTS_TIMEOUT,
989990
)
990991
if not driver_page.ok:
991992
return [ERROR_DRIVERS_PAGE_DOWNLOAD_FAILED]

adabot/lib/common_funcs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import os
1313
import re
1414
import requests
15-
from adabot import github_requests as gh_reqs
15+
from adabot import github_requests as gh_reqs, REQUESTS_TIMEOUT
1616
from adabot import pypi_requests as pypi
1717

1818
CORE_REPO_URL = "/repos/adafruit/circuitpython"
@@ -96,7 +96,7 @@ def get_bundle_submodules():
9696
# master branch of the bundle is the canonical source of the bundle release.
9797
result = requests.get(
9898
"https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/.gitmodules",
99-
timeout=15,
99+
timeout=REQUESTS_TIMEOUT,
100100
)
101101
if result.status_code != 200:
102102
# output_handler("Failed to access bundle .gitmodules file from GitHub!", quiet=True)

0 commit comments

Comments
 (0)