mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/
synced 2025-12-16 02:04:43 +08: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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user