Skip to content

Commit

Permalink
use timeout variable in a few more places
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Nov 12, 2024
1 parent 27e456f commit 6adb833
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions adabot/circuitpython_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import github as pygithub
import requests

from adabot import github_requests as gh_reqs
from adabot import github_requests as gh_reqs, REQUESTS_TIMEOUT
from adabot import pypi_requests as pypi
from adabot.lib import circuitpython_library_validators as cirpy_lib_vals
from adabot.lib import common_funcs
Expand Down Expand Up @@ -224,7 +224,7 @@ def run_library_checks(validators, kw_args, error_depth):
resp = requests.get(
"https://raw.githubusercontent.com/adafruit/"
"CircuitPython_Community_Bundle/main/.gitmodules",
timeout=30,
timeout=REQUESTS_TIMEOUT,
)
community_bundle_submodules = resp.text
community_library_count = community_bundle_submodules.count("submodule")
Expand Down
4 changes: 3 additions & 1 deletion adabot/circuitpython_library_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import sh
from sh.contrib import git

from adabot import REQUESTS_TIMEOUT
from adabot.lib import common_funcs


Expand Down Expand Up @@ -100,7 +101,8 @@ def get_patches(run_local):
return_list = []
if not run_local:
contents = requests.get(
"https://api.github.com/repos/adafruit/adabot/contents/patches"
"https://api.github.com/repos/adafruit/adabot/contents/patches",
timeout=REQUESTS_TIMEOUT
)
if contents.ok:
for patch in contents.json():
Expand Down
5 changes: 3 additions & 2 deletions adabot/lib/circuitpython_library_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,8 @@ def validate_readthedocs(self, repo):
return []
if not self.rtd_subprojects:
rtd_response = requests.get(
"https://readthedocs.org/api/v2/project/74557/subprojects/", timeout=15
"https://readthedocs.org/api/v2/project/74557/subprojects/",
timeout=REQUESTS_TIMEOUT,
)
if not rtd_response.ok:
return [ERROR_RTD_SUBPROJECT_FAILED]
Expand Down Expand Up @@ -985,7 +986,7 @@ def validate_core_driver_page(self, repo):
"https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/"
"main/docs/drivers.rst"
),
timeout=15,
timeout=REQUESTS_TIMEOUT,
)
if not driver_page.ok:
return [ERROR_DRIVERS_PAGE_DOWNLOAD_FAILED]
Expand Down
4 changes: 2 additions & 2 deletions adabot/lib/common_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os
import re
import requests
from adabot import github_requests as gh_reqs
from adabot import github_requests as gh_reqs, REQUESTS_TIMEOUT
from adabot import pypi_requests as pypi

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

0 comments on commit 6adb833

Please sign in to comment.