aboutsummaryrefslogtreecommitdiff
path: root/utils/upload.py
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2023-09-17 19:17:03 +0800
committerKunoiSayami <[email protected]>2023-09-17 19:17:03 +0800
commit35b38c50f9a8f0edc786265b6c21d7cf1da18666 (patch)
tree723c03144fc5c1ba81df686e1c903179bb61bf2c /utils/upload.py
parenta124e7d9b4528571819b87de99d47e274b66d3e2 (diff)
feat(script): Support proxy for upload
* fix(pkg): Fix liboping build Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'utils/upload.py')
-rwxr-xr-xutils/upload.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/upload.py b/utils/upload.py
index d3605cf..2fabd7c 100755
--- a/utils/upload.py
+++ b/utils/upload.py
@@ -5,6 +5,7 @@ import logging
import os
import aiohttp
+import aiohttp_socks
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
@@ -47,8 +48,14 @@ async def main(args: argparse.Namespace) -> int:
logger.info("Could not find any packaged packages, skip upload")
return 0
+ if proxy := os.getenv("http_proxy"):
+ logger.debug("Using proxy %s", proxy)
+ proxies = aiohttp_socks.ProxyConnector.from_url(proxy, rdns=False)
+ else:
+ proxies = None
+
async with aiohttp.ClientSession(
- raise_for_status=True, timeout=aiohttp.ClientTimeout(30)
+ raise_for_status=True, timeout=aiohttp.ClientTimeout(30), connector=proxies
) as session:
async with session.post(
args.remote_address, data=build_data(args, "REQUIRE_CLEAN")