Skip to content

Commit

Permalink
Merge pull request #3 from Pixee-Bot-Python/pixeebot/drip-2024-03-12-…
Browse files Browse the repository at this point in the history
…pixee-python/add-requests-timeouts

Add timeout to `requests` calls
  • Loading branch information
pixeeai committed Apr 24, 2024
2 parents 59255c4 + 7c1d9ed commit 0f8ccda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions freqtrade/commands/deploy_commands.py
Expand Up @@ -123,7 +123,7 @@ def download_and_install_ui(dest_folder: Path, dl_url: str, version: str):
from zipfile import ZipFile

logger.info(f"Downloading {dl_url}")
resp = requests.get(dl_url, timeout=req_timeout).content
resp = requests.get(dl_url, timeout=60).content
dest_folder.mkdir(parents=True, exist_ok=True)
with ZipFile(BytesIO(resp)) as zf:
for fn in zf.filelist:
Expand All @@ -141,7 +141,7 @@ def get_ui_download_url(version: Optional[str] = None) -> Tuple[str, str]:
base_url = 'https://api.github.com/repos/freqtrade/frequi/'
# Get base UI Repo path

resp = requests.get(f"{base_url}releases", timeout=req_timeout)
resp = requests.get(f"{base_url}releases", timeout=60)
resp.raise_for_status()
r = resp.json()

Expand All @@ -162,7 +162,7 @@ def get_ui_download_url(version: Optional[str] = None) -> Tuple[str, str]:
# URL not found - try assets url
if not dl_url:
assets = r[0]['assets_url']
resp = requests.get(assets, timeout=req_timeout)
resp = requests.get(assets, timeout=60)
r = resp.json()
dl_url = r[0]['browser_download_url']

Expand Down

0 comments on commit 0f8ccda

Please sign in to comment.