Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta: Add User-Agent string on request for download_file #25608

Merged
merged 1 commit into from
Jan 1, 2025

Conversation

EduHCS
Copy link
Contributor

@EduHCS EduHCS commented Dec 31, 2024

When downloading pnp_ids.csv from https://uefi.org/uefi-pnp-export it needs to have a User-Agent string set, or it will return an 403: Forbidden error.

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Dec 31, 2024
@@ -74,7 +74,7 @@ def main():

os.makedirs(output_file.parent, exist_ok=True)

request = urllib.request.Request(args.url, headers={"Accept-Encoding": "gzip"})
request = urllib.request.Request(args.url, headers={"Accept-Encoding": "gzip", "User-Agent": "Mozilla/5.0"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be Moz/5.0, or does (e.g.) "serenityos Meta/download_file.py" work as well?

Thanks for the PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and apparently it will work with anything, even an empty string, it just needs that the User-Agent be present in the request.

@EduHCS EduHCS force-pushed the uefi-pnp-download-error branch from 28fe3d7 to a6a7a13 Compare January 1, 2025 14:55
@nico nico force-pushed the uefi-pnp-download-error branch from a6a7a13 to 447aa54 Compare January 1, 2025 18:40
@nico nico merged commit e6099be into SerenityOS:master Jan 1, 2025
12 checks passed
@nico
Copy link
Contributor

nico commented Jan 1, 2025

Thanks!

@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants