summaryrefslogtreecommitdiff
path: root/banapedia/api
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/api
parent16529a0d212e1387eacd590c0e5e1b1a13dc2641 (diff)
downloadwikistats-bdf9099df8c2a4636b0ad0e710b73330877eef37.tar.gz
Very cleaner, much class, such readable, wow
Diffstat (limited to 'banapedia/api')
-rw-r--r--banapedia/api/Query.py23
-rw-r--r--banapedia/api/__init__.py0
2 files changed, 0 insertions, 23 deletions
diff --git a/banapedia/api/Query.py b/banapedia/api/Query.py
deleted file mode 100644
index 7453df9..0000000
--- a/banapedia/api/Query.py
+++ /dev/null
@@ -1,23 +0,0 @@
1import urllib.parse
2import urllib.request
3import json
4
5__author__ = 'pacien'
6
7
8class Query:
9 def __init__(self, base_url="", params={}, encoding="utf8"):
10 self.base_url = base_url
11 self.params = params
12 self.encoding = encoding
13
14 def fetch_raw_result(self):
15 post_query = urllib.parse.urlencode(self.params)
16 post_query = post_query.encode(self.encoding)
17 document = urllib.request.urlopen(self.base_url, post_query)
18 return document.read().decode(self.encoding)
19
20
21class JSONQuery(Query):
22 def fetch_result(self):
23 return json.loads(self.fetch_raw_result())
diff --git a/banapedia/api/__init__.py b/banapedia/api/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/banapedia/api/__init__.py
+++ /dev/null