From b3651e48e4cb1d90863da1d22997eff59eff74c1 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Wed, 22 Oct 2014 08:27:15 +0200 Subject: Use proper way to construct url --- src/downloader/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/downloader/__init__.py b/src/downloader/__init__.py index 4dd6169..830bdec 100644 --- a/src/downloader/__init__.py +++ b/src/downloader/__init__.py @@ -6,6 +6,7 @@ program, including manipulation of the wikimedia API. """ import urllib.request +import urllib.parse class Downloader(): @@ -86,5 +87,11 @@ class WikimediaAPI(): "Module talk": "829", "Topic": "2600" } - return self.endpoint + "?action=query&list=recentchanges&format="\ - + self.return_format + "&namespace=" + rcnamespaces[namespace] + + url_params = { + "action": "query", + "list": "recentchanges", + "format": self.return_format, + "namespace": rcnamespaces[namespace], + } + return urllib.parse.urljoin(self.endpoint, urllib.parse.urlencode(url_params).encode("utf8")) -- cgit v1.2.3