summaryrefslogtreecommitdiff
path: root/banapedia/wapi
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-10-24 19:59:05 +0200
committerPacien TRAN-GIRARD2014-10-24 19:59:05 +0200
commitbdf9099df8c2a4636b0ad0e710b73330877eef37 (patch)
tree63fd704f15f3030f1455aad0ef92403c5d093c70 /banapedia/wapi
parent16529a0d212e1387eacd590c0e5e1b1a13dc2641 (diff)
downloadwikistats-bdf9099df8c2a4636b0ad0e710b73330877eef37.tar.gz
Very cleaner, much class, such readable, wow
Diffstat (limited to 'banapedia/wapi')
-rw-r--r--banapedia/wapi/WikipediaQuery.py42
-rw-r--r--banapedia/wapi/__init__.py0
2 files changed, 0 insertions, 42 deletions
diff --git a/banapedia/wapi/WikipediaQuery.py b/banapedia/wapi/WikipediaQuery.py
deleted file mode 100644
index d3d2f94..0000000
--- a/banapedia/wapi/WikipediaQuery.py
+++ /dev/null
@@ -1,42 +0,0 @@
1from ..api.Query import JSONQuery
2
3__author__ = 'pacien'
4
5WIKIPEDIA_QUERY_BASE_URL = "https://en.wikipedia.org/w/api.php"
6LIST_SEPARATOR = "|"
7DEFAULT_BKPROP = ["id", "user", "userid", "by", "byid", "timestamp", "expiry", "reason", "range", "flags"]
8DEFAULT_BKSHOW = ["account", "temp", "ip", "range"]
9
10
11class WikipediaQuery(JSONQuery):
12 def __init__(self, params={}):
13 params.update({
14 "action": "query",
15 "format": "json",
16 })
17 JSONQuery.__init__(self, base_url=WIKIPEDIA_QUERY_BASE_URL, params=params)
18
19
20class ListQuery(WikipediaQuery):
21 def __init__(self, list_name, params={}):
22 params.update({
23 "list": list_name,
24 })
25 WikipediaQuery.__init__(self, params)
26
27
28class BlockQuery(ListQuery):
29 def __init__(self, bkprop=DEFAULT_BKPROP, bkshow=DEFAULT_BKSHOW, bkdir="newer", limit=500, continue_token=None):
30 params = {
31 "bkprop": LIST_SEPARATOR.join(bkprop),
32 "bkshow": LIST_SEPARATOR.join(bkshow),
33 "bkdir": bkdir,
34 "bklimit": limit,
35 }
36
37 if continue_token is not None:
38 params.update({"bkcontinue": continue_token})
39
40 ListQuery.__init__(self, "blocks", params=params)
41
42
diff --git a/banapedia/wapi/__init__.py b/banapedia/wapi/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/banapedia/wapi/__init__.py
+++ /dev/null