diff options
author | Pacien TRAN-GIRARD | 2014-10-22 08:27:15 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-10-22 08:27:15 +0200 |
commit | b3651e48e4cb1d90863da1d22997eff59eff74c1 (patch) | |
tree | 3e9326e4e263038706bc81cf9d44e0a7df3183c3 /src | |
parent | b2b0a0603957b9581efd23debbc42d9281c63300 (diff) | |
download | wikistats-b3651e48e4cb1d90863da1d22997eff59eff74c1.tar.gz |
Use proper way to construct url
Diffstat (limited to 'src')
-rw-r--r-- | src/downloader/__init__.py | 11 |
1 files changed, 9 insertions, 2 deletions
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. | |||
6 | """ | 6 | """ |
7 | 7 | ||
8 | import urllib.request | 8 | import urllib.request |
9 | import urllib.parse | ||
9 | 10 | ||
10 | 11 | ||
11 | class Downloader(): | 12 | class Downloader(): |
@@ -86,5 +87,11 @@ class WikimediaAPI(): | |||
86 | "Module talk": "829", | 87 | "Module talk": "829", |
87 | "Topic": "2600" | 88 | "Topic": "2600" |
88 | } | 89 | } |
89 | return self.endpoint + "?action=query&list=recentchanges&format="\ | 90 | |
90 | + self.return_format + "&namespace=" + rcnamespaces[namespace] | 91 | url_params = { |
92 | "action": "query", | ||
93 | "list": "recentchanges", | ||
94 | "format": self.return_format, | ||
95 | "namespace": rcnamespaces[namespace], | ||
96 | } | ||
97 | return urllib.parse.urljoin(self.endpoint, urllib.parse.urlencode(url_params).encode("utf8")) | ||