Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Add User-Agent option for Logo Lookup #40

Description

@randolf-scholz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions