Skip to content

Commit

Permalink
do not use urllib; use requests for all network things
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczmarj committed May 30, 2023
1 parent 00cce49 commit eacd806
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions wsinfer_zoo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional, Sequence, Tuple
import urllib.error
import urllib.request

import requests
from huggingface_hub import hf_hub_download
Expand Down Expand Up @@ -222,8 +220,7 @@ def _download_registry_if_necessary():
"""
try:
if _remote_registry_is_newer():
urllib.request.urlretrieve(
WSINFER_ZOO_REGISTRY_URL, WSINFER_ZOO_REGISTRY_DEFAULT_PATH
)
except (requests.RequestException, urllib.error.URLError) as e:
r = requests.get(WSINFER_ZOO_REGISTRY_URL)
WSINFER_ZOO_REGISTRY_DEFAULT_PATH.write_bytes(r.content)
except requests.RequestException as e:
print(f"Could not download most recent registry, error: {e}")

0 comments on commit eacd806

Please sign in to comment.