|
@@ -1,16 +0,0 @@
|
1
|
|
-from json import loads
|
2
|
|
-
|
3
|
|
-def request(query, params):
|
4
|
|
- params['url'] = 'http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=%s&srprop=timestamp&format=json' % query
|
5
|
|
-
|
6
|
|
- return params
|
7
|
|
-
|
8
|
|
-
|
9
|
|
-def response(resp):
|
10
|
|
- search_results = loads(resp.text)
|
11
|
|
- results = []
|
12
|
|
- res = search_results.get('query', {}).get('search', [])
|
13
|
|
- if len(res):
|
14
|
|
- results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res[0]['title'].replace(' ', '_'), 'title': res[0]['title']})
|
15
|
|
- return results
|
16
|
|
-
|