contrib: process_linux_firmware: set user agent
This should help avoid getting banned for looking like a bot since the script polls. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>main
parent
5aa42075d0
commit
b91a362b8e
|
|
@ -71,7 +71,16 @@ def classify_content(content):
|
||||||
|
|
||||||
def fetch_url(url):
|
def fetch_url(url):
|
||||||
blob = None
|
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()
|
blob = response.read()
|
||||||
m = magic.Magic(mime_encoding=True)
|
m = magic.Magic(mime_encoding=True)
|
||||||
return blob.decode(m.from_buffer(blob))
|
return blob.decode(m.from_buffer(blob))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue