fix(wiki-article): correct URL escaping issue
Some checks failed
Python Package CI/CD / Publish to PyPI (push) Failing after 1m3s

Switched to single quotes for the title replacement in the URL to ensure compatibility with older Python versions.
This commit is contained in:
Kumi 2024-07-16 10:18:44 +02:00
parent e8823de045
commit 0e37e0524b
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -112,7 +112,7 @@ def wiki_article(project, lang, title):
logger.debug(f"Fetching {title} from {base_url}")
url = f"{base_url}/w/api.php?action=query&format=json&titles={escape(title.replace(" ", "_"), True)}&prop=revisions&rvprop=content&rvparse=1"
url = f"{base_url}/w/api.php?action=query&format=json&titles={escape(title.replace(' ', '_'), True)}&prop=revisions&rvprop=content&rvparse=1"
with urllib.request.urlopen(url) as response:
data = json.loads(response.read().decode())
pages = data["query"]["pages"]