mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/
synced 2025-12-25 07:52:43 +08:00
Merge branch 'superm1/user-agent' into 'main'
contrib: process_linux_firmware: set user agent See merge request kernel-firmware/linux-firmware!517
This commit is contained in:
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user