This should help avoid getting banned for looking like a bot since
the script polls.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
def fetch_url(url):
blob = None
- with urllib.request.urlopen(url) as response:
+ req = urllib.request.Request(
+ url,
+ data=None,
+ headers={
+ "User-Agent": "linux-firmware-ci/1.x ({email})".format(
+ email=os.getenv("EMAIL")
+ )
+ },
+ )
+ with urllib.request.urlopen(req) as response:
blob = response.read()
m = magic.Magic(mime_encoding=True)
return blob.decode(m.from_buffer(blob))