@@ -1,10 +1,10 @@
11#!/usr/bin/env python
22
33## Flickr (Images)
4−#
4+#
55# @website https://www.flickr.com
6−# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html)
7−#
6+# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html)
7+#
88# @using-api yes
99# @results JSON
1010# @stable yes
@@ -18,16 +18,20 @@ categories = ['images']
1818
1919nb_per_page = 15
2020paging = True
21−api_key= None
21+api_key = None
2222
2323
24−url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key={api_key}&{text}&sort=relevance&extras=description%2C+owner_name%2C+url_o%2C+url_z&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}'
24+url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search' +\
25+ '&api_key={api_key}&{text}&sort=relevance' +\
26+ '&extras=description%2C+owner_name%2C+url_o%2C+url_z' +\
27+ '&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}'
2528photo_url = 'https://www.flickr.com/photos/{userid}/{photoid}'
2629
2730paging = True
2831
32+
2933def build_flickr_url(user_id, photo_id):
30− return photo_url.format(userid=user_id,photoid=photo_id)
34+ return photo_url.format(userid=user_id, photoid=photo_id)
3135
3236
3337def request(query, params):
@@ -40,7 +44,7 @@ def request(query, params):
4044
4145def response(resp):
4246 results = []
43−
47+
4448 search_results = loads(resp.text)
4549
4650 # return empty array if there are no results
@@ -64,11 +68,14 @@ def response(resp):
6468 url = build_flickr_url(photo['owner'], photo['id'])
6569
6670 title = photo['title']
67−
68− content = '<span class="photo-author">'+ photo['ownername'] +'</span><br />'
69−
70− content = content + '<span class="description">' + photo['description']['_content'] + '</span>'
71−
71+
72+ content = '<span class="photo-author">' +\
73+ photo['ownername'] +\
74+ '</span><br />' +\
75+ '<span class="description">' +\
76+ photo['description']['_content'] +\
77+ '</span>'
78+
7279 # append result
7380 results.append({'url': url,
7481 'title': title,