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

Add User-Agent option for Logo Lookup #40

Open
randolf-scholz opened this issue Feb 27, 2023 · 0 comments
Open

Add User-Agent option for Logo Lookup #40

randolf-scholz opened this issue Feb 27, 2023 · 0 comments

Comments

@randolf-scholz
Copy link

Trying to source logos for example from wikipedia can run into:

requests.exceptions.HTTPError: 403 Client Error: Forbidden. Please comply with the User-Agent policy: https://meta.wikimedia.org/wiki/User-Agent_policy

Which states that there must be user-agent information or scripts may be blocked without notice. The expected format is

<client name>/<version> (<contact information>) <library/framework name>/<version> [<library name>/<version> ...]

They provide a template for python:

import requests

url = 'https://example/...'
headers = {'User-Agent': 'CoolBot/0.0 (https://example.org/coolbot/; coolbot@example.org)'}

response = requests.get(url, headers=headers)

Suggestions:

  • Add standard header like {'User-Agent': 'pybadges/3.0.0 (https://github.com/google/pybadges/)}
  • And/Or add --user-agent option to allow passing this information manually.
@randolf-scholz randolf-scholz changed the title Add header option to URL lookup Add User-Agent option for Logo Lookup Feb 27, 2023
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

No branches or pull requests

1 participant