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.