mirror of
https://gitlab.com/kernel-firmware/linux-firmware.git
synced 2025-12-09 23:34:49 +01:00
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>
This commit is contained in:
parent
5aa42075d0
commit
b91a362b8e
1 changed files with 10 additions and 1 deletions
|
|
@ -71,7 +71,16 @@ def classify_content(content):
|
|||
|
||||
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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue