Skip to content

403 Error When Requesting Wiktionary Pages #1

@lennon-c

Description

@lennon-c

Requests to Wiktionary/Wikipedia are currently failing with a 403 Forbidden error.
This is due to a recent change on Wikipedia’s side: automated requests without a User-Agent header are now rejected.

Solution:
Add a descriptive User-Agent header that identifies the purpose of the requests

title = 'stark'
url = f'https://de.wiktionary.org/wiki/Spezial:Exportieren/{title}'

# you can decide what to give, use a descriptive text
headers = {
    "User-Agent": "Search for German words"
}

# Send a GET request
resp = requests.get(url, headers=headers)

Tasks: update tutorials

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions