Support socks proxies when fetching versions

This commit is contained in:
Damien Elmes 2025-08-08 20:21:48 +10:00 committed by Thomas Rixen
parent 54c1db87d6
commit fea66f25b1
2 changed files with 19 additions and 18 deletions

View file

@ -661,7 +661,7 @@ fn fetch_versions(state: &State) -> Result<Vec<String>> {
let mut cmd = Command::new(&state.uv_path); let mut cmd = Command::new(&state.uv_path);
cmd.current_dir(&state.uv_install_root) cmd.current_dir(&state.uv_install_root)
.args(["run", "--no-project", "--no-config", "--managed-python"]) .args(["run", "--no-project", "--no-config", "--managed-python"])
.args(["--with", "pip-system-certs"]); .args(["--with", "pip-system-certs,requests[socks]"]);
let python_version = read_file(&state.dist_python_version_path)?; let python_version = read_file(&state.dist_python_version_path)?;
let python_version_str = let python_version_str =

View file

@ -3,9 +3,9 @@
import json import json
import sys import sys
import urllib.request
import pip_system_certs.wrapt_requests import pip_system_certs.wrapt_requests
import requests
pip_system_certs.wrapt_requests.inject_truststore() pip_system_certs.wrapt_requests.inject_truststore()
@ -15,8 +15,9 @@ def main():
url = "https://pypi.org/pypi/aqt/json" url = "https://pypi.org/pypi/aqt/json"
try: try:
with urllib.request.urlopen(url, timeout=30) as response: response = requests.get(url, timeout=30)
data = json.loads(response.read().decode("utf-8")) response.raise_for_status()
data = response.json()
releases = data.get("releases", {}) releases = data.get("releases", {})
# Create list of (version, upload_time) tuples # Create list of (version, upload_time) tuples