Fix: fix from copilot

This commit is contained in:
Kirill Sobakin
2026-03-16 23:54:56 +03:00
parent 689a9ea755
commit fee4746b57
2 changed files with 4 additions and 3 deletions

View File

@@ -68,7 +68,7 @@ def fetch_asn_prefixes(asn_list):
url = RIPE_STAT_URL.format(asn)
req = make_request(url)
try:
with urllib.request.urlopen(req) as response:
with urllib.request.urlopen(req, timeout=30) as response:
data = json.loads(response.read().decode('utf-8'))
for entry in data['data']['prefixes']:
prefix = entry['prefix']
@@ -94,7 +94,7 @@ def download_subnets(*urls):
for url in urls:
req = make_request(url)
try:
with urllib.request.urlopen(req) as response:
with urllib.request.urlopen(req, timeout=30) as response:
subnets = response.read().decode('utf-8').splitlines()
for subnet_str in subnets:
try:
@@ -118,7 +118,7 @@ def download_aws_cloudfront_subnets():
req = make_request(AWS_CIDR_URL)
try:
with urllib.request.urlopen(req) as response:
with urllib.request.urlopen(req, timeout=30) as response:
data = json.loads(response.read().decode('utf-8'))
for prefix in data.get('prefixes', []):