79590046

Date: 2025-04-24 07:41:46
Score: 0.5
Natty:
Report link

I can confirm what @jxtps mentioned in the comment: logging into the relevant Wikimedia project is required to activate the API key.

For instance, if you're making a request to a German Wikipedia page, your Python code might look like this:

access_token = 'your-long-access-token'

response = requests.get(
    'https://de.wikipedia.org/w/api.php',
    params={
        'action': 'query',
        'format': 'json',
        'titles': 'Judas_Priest',
        'prop': 'revisions',
        'rvlimit': 1,
    },
    headers={
        'Authorization': f'Bearer {access_token}',
    }
)

However, if you haven’t logged into the German Wikipedia (in this case, de.wikipedia.org), the API call will fail — likely with a 403 error. Simply visiting the page in your browser while logged in will activate your access token for that specific project, and subsequent API calls should return a successful 200 response.

This issue should be considered resolved.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @jxtps
  • Low reputation (0.5):
Posted by: Mauro Mascia