repology-openmamba.py: provide a custom user agent as required by repology.org policy

This commit is contained in:
Silvan Calarco 2024-09-14 15:00:16 +02:00
parent 0c2162fe62
commit f54041d4df

View File

@ -30,7 +30,12 @@ while True:
requrl += from_package +"/" requrl += from_package +"/"
requrl += "?inrepo=openmamba&outdated=1" requrl += "?inrepo=openmamba&outdated=1"
sys.stderr.write("Requesting: " + requrl + "\n") sys.stderr.write("Requesting: " + requrl + "\n")
url = urllib.request.urlopen(requrl) req = urllib.request.Request(
requrl,
data=None,
headers={'User-Agent': 'autodist/1.5.3 (Linux; openmamba; reports@openmamba.org)'}
)
url = urllib.request.urlopen(req)
#print(requrl) #print(requrl)
data = json.loads(url.read().decode()) data = json.loads(url.read().decode())