Merge lp:~submarine/ubuntu-scopes/openweathermap-previews into lp:~submarine/ubuntu-scopes/openweathermap
- openweathermap-previews
- Merge into openweathermap
Proposed by
David Callé
Status: | Merged |
---|---|
Approved by: | Michal Hruby |
Approved revision: | 24 |
Merged at revision: | 21 |
Proposed branch: | lp:~submarine/ubuntu-scopes/openweathermap-previews |
Merge into: | lp:~submarine/ubuntu-scopes/openweathermap |
Diff against target: |
313 lines (+187/-27) 3 files modified
data/openweathermap.scope.in (+1/-1) src/unity_openweathermap_daemon.py (+184/-24) tests/test_openweathermap.py (+2/-2) |
To merge this branch: | bzr merge lp:~submarine/ubuntu-scopes/openweathermap-previews |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michal Hruby (community) | Approve | ||
Review via email:
|
Commit message
Initial previews (with Flickr weather project support)
Description of the change
Initial previews.
- Displays a geolocalized photo with matching weather (using Flickr weather project)
- If no photo is found, a "Submit photo" button appears, opening the Flickr weather project group.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/openweathermap.scope.in' | |||
2 | --- data/openweathermap.scope.in 2013-03-15 17:29:42 +0000 | |||
3 | +++ data/openweathermap.scope.in 2013-03-27 13:24:21 +0000 | |||
4 | @@ -4,7 +4,7 @@ | |||
5 | 4 | Icon= | 4 | Icon= |
6 | 5 | _Keywords=openweathermap;weather;sky;forecast; | 5 | _Keywords=openweathermap;weather;sky;forecast; |
7 | 6 | RequiredMetadata= | 6 | RequiredMetadata= |
9 | 7 | OptionalMetadata= | 7 | OptionalMetadata=min_temp[s];max_temp[s];pressure[s];humidity[s];wind_speed[s];wind_direction[s];latitude[s];longitude[s]; |
10 | 8 | Loader=/usr/share/unity-scopes/openweathermap/unity_openweathermap_daemon.py | 8 | Loader=/usr/share/unity-scopes/openweathermap/unity_openweathermap_daemon.py |
11 | 9 | RemoteContent=true | 9 | RemoteContent=true |
12 | 10 | Type=info | 10 | Type=info |
13 | 11 | 11 | ||
14 | === modified file 'src/unity_openweathermap_daemon.py' | |||
15 | --- src/unity_openweathermap_daemon.py 2013-03-21 18:00:25 +0000 | |||
16 | +++ src/unity_openweathermap_daemon.py 2013-03-27 13:24:21 +0000 | |||
17 | @@ -21,6 +21,7 @@ | |||
18 | 21 | import json | 21 | import json |
19 | 22 | import datetime | 22 | import datetime |
20 | 23 | import gettext | 23 | import gettext |
21 | 24 | from random import randrange | ||
22 | 24 | 25 | ||
23 | 25 | APP_NAME = 'unity-scope-openweathermap' | 26 | APP_NAME = 'unity-scope-openweathermap' |
24 | 26 | LOCAL_PATH = '/usr/share/locale/' | 27 | LOCAL_PATH = '/usr/share/locale/' |
25 | @@ -39,7 +40,7 @@ | |||
26 | 39 | PROVIDER_ICON = SVG_DIR+'service-openweathermap.svg' | 40 | PROVIDER_ICON = SVG_DIR+'service-openweathermap.svg' |
27 | 40 | DEFAULT_RESULT_ICON = SVG_DIR+'result-info.svg' | 41 | DEFAULT_RESULT_ICON = SVG_DIR+'result-info.svg' |
28 | 41 | DEFAULT_RESULT_MIMETYPE = 'text/html' | 42 | DEFAULT_RESULT_MIMETYPE = 'text/html' |
30 | 42 | DEFAULT_RESULT_TYPE = Unity.ResultType.PERSONAL | 43 | DEFAULT_RESULT_TYPE = Unity.ResultType.DEFAULT |
31 | 43 | 44 | ||
32 | 44 | c1 = {'id' :'weather', | 45 | c1 = {'id' :'weather', |
33 | 45 | 'name' :_('Weather Forecast'), | 46 | 'name' :_('Weather Forecast'), |
34 | @@ -47,13 +48,37 @@ | |||
35 | 47 | 'renderer':Unity.CategoryRenderer.VERTICAL_TILE} | 48 | 'renderer':Unity.CategoryRenderer.VERTICAL_TILE} |
36 | 48 | CATEGORIES = [c1] | 49 | CATEGORIES = [c1] |
37 | 49 | FILTERS = [] | 50 | FILTERS = [] |
39 | 50 | EXTRA_METADATA = [] | 51 | m1 = {'id' :'min_temp', |
40 | 52 | 'type' :'s', | ||
41 | 53 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
42 | 54 | m2 = {'id' :'max_temp', | ||
43 | 55 | 'type' :'s', | ||
44 | 56 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
45 | 57 | m3 = {'id' :'pressure', | ||
46 | 58 | 'type' :'s', | ||
47 | 59 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
48 | 60 | m4 = {'id' :'humidity', | ||
49 | 61 | 'type' :'s', | ||
50 | 62 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
51 | 63 | m5 = {'id' :'wind_speed', | ||
52 | 64 | 'type' :'s', | ||
53 | 65 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
54 | 66 | m6 = {'id' :'wind_direction', | ||
55 | 67 | 'type' :'s', | ||
56 | 68 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
57 | 69 | m7 = {'id' :'latitude', | ||
58 | 70 | 'type' :'s', | ||
59 | 71 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
60 | 72 | m8 = {'id' :'longitude', | ||
61 | 73 | 'type' :'s', | ||
62 | 74 | 'field':Unity.SchemaFieldType.OPTIONAL} | ||
63 | 75 | EXTRA_METADATA = [m1, m2, m3, m4, m5, m6, m7, m8] | ||
64 | 51 | 76 | ||
65 | 52 | def weather_search(query, s_type): | 77 | def weather_search(query, s_type): |
66 | 53 | print (query) | 78 | print (query) |
67 | 54 | query = urllib.parse.quote(str(query)) | 79 | query = urllib.parse.quote(str(query)) |
68 | 55 | data = None | 80 | data = None |
70 | 56 | if not query: | 81 | if not query or len(query) <= 1: |
71 | 57 | return data | 82 | return data |
72 | 58 | if s_type == 'forecast': | 83 | if s_type == 'forecast': |
73 | 59 | uri = "%s%s?mode=daily_compact&units=metric" % (SEARCH_URI[1], query) | 84 | uri = "%s%s?mode=daily_compact&units=metric" % (SEARCH_URI[1], query) |
74 | @@ -113,10 +138,30 @@ | |||
75 | 113 | wind = place_data['list'][0]['wind']['speed'] | 138 | wind = place_data['list'][0]['wind']['speed'] |
76 | 114 | temp_c = float(place_data['list'][0]['main']['temp']) | 139 | temp_c = float(place_data['list'][0]['main']['temp']) |
77 | 115 | temp_f = temp_c*(9.0/5.0)+32 | 140 | temp_f = temp_c*(9.0/5.0)+32 |
80 | 116 | temp = '%i%sC/%i%sF' % (int(temp_c), u"\u00B0", int(temp_f), u"\u00B0") | 141 | temp = '%i%sC / %i%sF' % (int(temp_c), u"\u00B0", int(temp_f), u"\u00B0") |
81 | 117 | title = _('Today') + '\n' + temp | 142 | name = place_data['list'][0]['name'] |
82 | 143 | country = place_data['list'][0]['sys']['country'] | ||
83 | 144 | title = name + ', ' + country + '\n' + temp | ||
84 | 118 | city_id = place_data['list'][0]['id'] | 145 | city_id = place_data['list'][0]['id'] |
85 | 119 | uri = place_data['list'][0]['url'] | 146 | uri = place_data['list'][0]['url'] |
86 | 147 | min_temp_c = float(place_data['list'][0]['main']['temp_min']) | ||
87 | 148 | min_temp_f = min_temp_c*(9.0/5.0)+32 | ||
88 | 149 | min_temp = '%i%sC / %i%sF' % (int(min_temp_c), u"\u00B0", int(min_temp_f), u"\u00B0") | ||
89 | 150 | max_temp_c = float(place_data['list'][0]['main']['temp_max']) | ||
90 | 151 | max_temp_f = max_temp_c*(9.0/5.0)+32 | ||
91 | 152 | max_temp = '%i%sC / %i%sF' % (int(max_temp_c), u"\u00B0", int(max_temp_f), u"\u00B0") | ||
92 | 153 | try: | ||
93 | 154 | pressure = place_data['list'][0]['main']['pressure'] | ||
94 | 155 | except: | ||
95 | 156 | pressure = '' | ||
96 | 157 | try: | ||
97 | 158 | humidity = place_data['list'][0]['main']['humidity'] | ||
98 | 159 | except: | ||
99 | 160 | humidity = '' | ||
100 | 161 | wind_speed = place_data['list'][0]['wind']['speed'] | ||
101 | 162 | wind_direction = place_data['list'][0]['wind']['deg'] | ||
102 | 163 | latitude = place_data['list'][0]['coord']['lat'] | ||
103 | 164 | longitude = place_data['list'][0]['coord']['lon'] | ||
104 | 120 | except Exception as error: | 165 | except Exception as error: |
105 | 121 | print(error) | 166 | print(error) |
106 | 122 | return results | 167 | return results |
107 | @@ -125,7 +170,15 @@ | |||
108 | 125 | results.append({'uri':uri, | 170 | results.append({'uri':uri, |
109 | 126 | 'icon':icon, | 171 | 'icon':icon, |
110 | 127 | 'title':title, | 172 | 'title':title, |
112 | 128 | 'comment':description}) | 173 | 'comment':description, |
113 | 174 | 'min_temp':GLib.Variant('s', min_temp), | ||
114 | 175 | 'max_temp':GLib.Variant('s', max_temp), | ||
115 | 176 | 'pressure':GLib.Variant('s', str(pressure)), | ||
116 | 177 | 'humidity':GLib.Variant('s', str(humidity)), | ||
117 | 178 | 'wind_speed':GLib.Variant('s', str(wind_speed)), | ||
118 | 179 | 'wind_direction':GLib.Variant('s', str(wind_direction)), | ||
119 | 180 | 'latitude':GLib.Variant('s', str(latitude)), | ||
120 | 181 | 'longitude':GLib.Variant('s', str(longitude))}) | ||
121 | 129 | forecast = weather_search(city_id, 'forecast') | 182 | forecast = weather_search(city_id, 'forecast') |
122 | 130 | if not forecast or not "list" in forecast: | 183 | if not forecast or not "list" in forecast: |
123 | 131 | return results | 184 | return results |
124 | @@ -140,18 +193,35 @@ | |||
125 | 140 | try: | 193 | try: |
126 | 141 | description = forecast['list'][i]['weather'][0]['description'] | 194 | description = forecast['list'][i]['weather'][0]['description'] |
127 | 142 | icon = get_icon(forecast['list'][i]['weather'][0]['icon']) | 195 | icon = get_icon(forecast['list'][i]['weather'][0]['icon']) |
128 | 143 | wind = forecast['list'][i]['speed'] | ||
129 | 144 | temp_c = float(forecast['list'][i]['temp']) | 196 | temp_c = float(forecast['list'][i]['temp']) |
130 | 145 | temp_f = temp_c*(9.0/5.0)+32 | 197 | temp_f = temp_c*(9.0/5.0)+32 |
132 | 146 | temp = '%i%sC/%i%sF' % (int(temp_c), u"\u00B0", int(temp_f), u"\u00B0") | 198 | temp = '%i%sC / %i%sF' % (int(temp_c), u"\u00B0", int(temp_f), u"\u00B0") |
133 | 147 | title = day_name + '\n' + temp | 199 | title = day_name + '\n' + temp |
134 | 200 | min_temp_c = float(forecast['list'][i]['morn']) | ||
135 | 201 | min_temp_f = min_temp_c*(9.0/5.0)+32 | ||
136 | 202 | min_temp = '%i%sC / %i%sF' % (int(min_temp_c), u"\u00B0", int(min_temp_f), u"\u00B0") | ||
137 | 203 | max_temp_c = float(forecast['list'][i]['eve']) | ||
138 | 204 | max_temp_f = max_temp_c*(9.0/5.0)+32 | ||
139 | 205 | max_temp = '%i%sC / %i%sF' % (int(max_temp_c), u"\u00B0", int(max_temp_f), u"\u00B0") | ||
140 | 206 | pressure = forecast['list'][i]['pressure'] | ||
141 | 207 | humidity = forecast['list'][i]['humidity'] | ||
142 | 208 | wind_speed = forecast['list'][i]['speed'] | ||
143 | 209 | wind_direction = forecast['list'][i]['deg'] | ||
144 | 148 | except Exception as error: | 210 | except Exception as error: |
145 | 149 | print(error) | 211 | print(error) |
146 | 150 | return results | 212 | return results |
147 | 151 | results.append({'uri':uri+"#"+day_name, | 213 | results.append({'uri':uri+"#"+day_name, |
148 | 152 | 'icon':icon, | 214 | 'icon':icon, |
149 | 153 | 'title':title, | 215 | 'title':title, |
151 | 154 | 'comment':description}) | 216 | 'comment':description, |
152 | 217 | 'min_temp':GLib.Variant('s', min_temp), | ||
153 | 218 | 'max_temp':GLib.Variant('s', max_temp), | ||
154 | 219 | 'pressure':GLib.Variant('s', str(pressure)), | ||
155 | 220 | 'humidity':GLib.Variant('s', str(humidity)), | ||
156 | 221 | 'wind_speed':GLib.Variant('s', str(wind_speed)), | ||
157 | 222 | 'wind_direction':GLib.Variant('s', str(wind_direction)), | ||
158 | 223 | 'latitude':GLib.Variant('s', str(latitude)), | ||
159 | 224 | 'longitude':GLib.Variant('s', str(longitude))}) | ||
160 | 155 | return results | 225 | return results |
161 | 156 | 226 | ||
162 | 157 | 227 | ||
163 | @@ -188,21 +258,97 @@ | |||
164 | 188 | i['comment'] = '' | 258 | i['comment'] = '' |
165 | 189 | if not 'dnd_uri' in i or not i['dnd_uri'] or i['dnd_uri'] == '': | 259 | if not 'dnd_uri' in i or not i['dnd_uri'] or i['dnd_uri'] == '': |
166 | 190 | i['dnd_uri'] = i['uri'] | 260 | i['dnd_uri'] = i['uri'] |
182 | 191 | i['metadata'] = {} | 261 | i['provider_credits'] = GLib.Variant('s', PROVIDER_CREDITS) |
183 | 192 | if EXTRA_METADATA: | 262 | result_set.add_result(**i) |
184 | 193 | for e in i: | 263 | except Exception as error: |
185 | 194 | for m in EXTRA_METADATA: | 264 | print (error) |
186 | 195 | if m['id'] == e: | 265 | |
187 | 196 | i['metadata'][e] = i[e] | 266 | class Preview (Unity.ResultPreviewer): |
188 | 197 | i['metadata']['provider_credits'] = GLib.Variant('s', PROVIDER_CREDITS) | 267 | |
189 | 198 | result = Unity.ScopeResult.create(str(i['uri']), str(i['icon']), | 268 | def get_image(self,q, lat, lon): |
190 | 199 | i['category'], i['result_type'], | 269 | print (lat, lon) |
191 | 200 | str(i['mimetype']), str(i['title']), | 270 | flick_map={'weather-clear':'clear', |
192 | 201 | str(i['comment']), str(i['dnd_uri']), | 271 | 'weather-clear-night':'clear', |
193 | 202 | i['metadata']) | 272 | 'weather-few-clouds':'cloudy', |
194 | 203 | result_set.add_result(result) | 273 | 'weather-few-clouds-night':'cloudy', |
195 | 204 | except Exception as error: | 274 | 'weather-clouds':'cloudy', |
196 | 205 | print (error) | 275 | 'weather-clouds-night':'cloudy', |
197 | 276 | 'weather-overcast':'cloudy', | ||
198 | 277 | 'weather-overcast':'cloudy', | ||
199 | 278 | 'weather-showers-scattered':'rain', | ||
200 | 279 | 'weather-showers-scattered':'rain', | ||
201 | 280 | 'weather-showers':'rain', | ||
202 | 281 | 'weather-showers':'rain', | ||
203 | 282 | 'weather-storm':'storm', | ||
204 | 283 | 'weather-storm':'storm', | ||
205 | 284 | 'weather-snow':'snow', | ||
206 | 285 | 'weather-snow':'snow', | ||
207 | 286 | 'weather-fog':'fog', | ||
208 | 287 | 'weather-fog':'fog'} | ||
209 | 288 | license_list = ["All Rights Reserved", | ||
210 | 289 | "Attribution-NonCommercial-ShareAlike License", | ||
211 | 290 | "Attribution-NonCommercial License", | ||
212 | 291 | "Attribution-NonCommercial-NoDerivs License", | ||
213 | 292 | "Attribution License", | ||
214 | 293 | "Attribution-ShareAlike License", | ||
215 | 294 | "Attribution-NoDerivs License", | ||
216 | 295 | "No known copyright restrictions", | ||
217 | 296 | "United States Government Work"] | ||
218 | 297 | image = None | ||
219 | 298 | query = urllib.parse.quote(flick_map[q]) | ||
220 | 299 | key = 'd87224f0b467093b2a87fd788d950e27' | ||
221 | 300 | uri = 'http://secure.flickr.com/services/rest/?method=flickr.photos.search&nojsoncallback=1&per_page=20&api_key=%s&extras=url_m,owner_name,license&group_id=1463451@N25&format=json&tag_mode=all&tags=%s&bbox=%f,%f,%f,%f' % (key, | ||
222 | 301 | query, | ||
223 | 302 | round(float(lon) - 0.1, 2), round(float(lat) - 0.1, 2), | ||
224 | 303 | round(float(lon) + 0.1, 2), round(float(lat) +0.1, 2)) | ||
225 | 304 | print (uri) | ||
226 | 305 | try: | ||
227 | 306 | response = urllib.request.urlopen(uri).read() | ||
228 | 307 | data = json.loads(response.decode('utf-8')) | ||
229 | 308 | photo = randrange(len(data['photos']['photo'])) | ||
230 | 309 | image = data['photos']['photo'][photo]['url_m'] | ||
231 | 310 | owner = data['photos']['photo'][photo]['ownername'] | ||
232 | 311 | license = license_list[int(data['photos']['photo'][photo]['license'])] | ||
233 | 312 | link = 'https://www.flickr.com/photos/%s/%s' % (data['photos']['photo'][photo]['owner'], data['photos']['photo'][photo]['id']) | ||
234 | 313 | except Exception as error: | ||
235 | 314 | print (error) | ||
236 | 315 | image, owner, license, link = None, None, None, None | ||
237 | 316 | return image, owner, license, link | ||
238 | 317 | |||
239 | 318 | def do_run(self): | ||
240 | 319 | |||
241 | 320 | preview = Unity.GenericPreview.new(self.result.title.split('\n')[0], '', None) | ||
242 | 321 | preview.props.subtitle = self.result.comment.capitalize() | ||
243 | 322 | image, owner, license, link = self.get_image(self.result.icon_hint, | ||
244 | 323 | self.result.metadata['latitude'].get_string(), | ||
245 | 324 | self.result.metadata['longitude'].get_string()) | ||
246 | 325 | |||
247 | 326 | gfile_icon = Gio.file_new_for_path(PROVIDER_ICON) | ||
248 | 327 | gicon = Gio.FileIcon.new (gfile_icon) | ||
249 | 328 | open_action = Unity.PreviewAction.new("open", _("Open Weather Map"), gicon) | ||
250 | 329 | preview.add_action(open_action) | ||
251 | 330 | preview.add_info(Unity.InfoHint.new("min_temp", _("Minimum Temperature"), None, self.result.metadata['min_temp'].get_string())) | ||
252 | 331 | preview.add_info(Unity.InfoHint.new("max_temp", _("Maximum Temperature"), None, self.result.metadata['max_temp'].get_string())) | ||
253 | 332 | preview.add_info(Unity.InfoHint.new("wind_speed", _("Wind Speed"), None, self.result.metadata['wind_speed'].get_string() + ' m/s')) | ||
254 | 333 | preview.add_info(Unity.InfoHint.new("wind_direction", _("Wind Direction"), None, self.result.metadata['wind_direction'].get_string() + u"\u00B0")) | ||
255 | 334 | if self.result.metadata['pressure'].get_string() != '': | ||
256 | 335 | preview.add_info(Unity.InfoHint.new("pressure", _("Pressure"), None, self.result.metadata['pressure'].get_string() + ' hPa')) | ||
257 | 336 | if self.result.metadata['humidity'].get_string() != '': | ||
258 | 337 | preview.add_info(Unity.InfoHint.new("humidity", _("Humidity"), None, self.result.metadata['humidity'].get_string() + '%')) | ||
259 | 338 | if image: | ||
260 | 339 | preview.props.image_source_uri = image | ||
261 | 340 | gfile_icon = Gio.file_new_for_path(SVG_DIR+'service-flickr.svg') | ||
262 | 341 | gicon = Gio.FileIcon.new (gfile_icon) | ||
263 | 342 | preview.add_info(Unity.InfoHint.new("photo_owner", _("Photo source"), gicon, 'Flickr')) | ||
264 | 343 | preview.add_info(Unity.InfoHint.new("photo_owner", _("Photo credit"), None, owner)) | ||
265 | 344 | preview.add_info(Unity.InfoHint.new("photo_license", _("Photo license"), None, license)) | ||
266 | 345 | else: | ||
267 | 346 | gfile_icon = Gio.file_new_for_path(SVG_DIR+'service-flickr.svg') | ||
268 | 347 | gicon = Gio.FileIcon.new (gfile_icon) | ||
269 | 348 | submit_action = Unity.PreviewAction.new("submit", _("Submit Photo"), gicon) | ||
270 | 349 | preview.add_action(submit_action) | ||
271 | 350 | return preview | ||
272 | 351 | |||
273 | 206 | 352 | ||
274 | 207 | class Scope (Unity.AbstractScope): | 353 | class Scope (Unity.AbstractScope): |
275 | 208 | def __init__(self): | 354 | def __init__(self): |
276 | @@ -255,5 +401,19 @@ | |||
277 | 255 | se = MySearch (search_context) | 401 | se = MySearch (search_context) |
278 | 256 | return se | 402 | return se |
279 | 257 | 403 | ||
280 | 404 | def do_create_previewer(self, result, metadata): | ||
281 | 405 | rp = Preview() | ||
282 | 406 | rp.set_scope_result(result) | ||
283 | 407 | rp.set_search_metadata(metadata) | ||
284 | 408 | return rp | ||
285 | 409 | |||
286 | 410 | def do_activate(self, result, metadata, id): | ||
287 | 411 | if not id: | ||
288 | 412 | return Unity.ActivationResponse(handled=Unity.HandledType.SHOW_PREVIEW, goto_uri=result.uri) | ||
289 | 413 | if id == 'submit': | ||
290 | 414 | uri = 'https://www.flickr.com/groups/projectweather/' | ||
291 | 415 | return Unity.ActivationResponse(handled=Unity.HandledType.HIDE_DASH, goto_uri=uri) | ||
292 | 416 | return | ||
293 | 417 | |||
294 | 258 | def load_scope(): | 418 | def load_scope(): |
295 | 259 | return Scope() | 419 | return Scope() |
296 | 260 | 420 | ||
297 | === modified file 'tests/test_openweathermap.py' | |||
298 | --- tests/test_openweathermap.py 2013-03-21 18:20:20 +0000 | |||
299 | +++ tests/test_openweathermap.py 2013-03-27 13:24:21 +0000 | |||
300 | @@ -43,11 +43,11 @@ | |||
301 | 43 | 'file:tests/data/mock_openweathermap_city_pass#'] | 43 | 'file:tests/data/mock_openweathermap_city_pass#'] |
302 | 44 | expected_results = ['http://openweathermap.org/city/3026083', | 44 | expected_results = ['http://openweathermap.org/city/3026083', |
303 | 45 | 'weather-snow', | 45 | 'weather-snow', |
305 | 46 | 'Today\n0°C/33°F', | 46 | 'Chatillon, FR\n0°C / 33°F', |
306 | 47 | 'heavy snow', | 47 | 'heavy snow', |
307 | 48 | 'http://openweathermap.org/city/3026083#Tomorrow', | 48 | 'http://openweathermap.org/city/3026083#Tomorrow', |
308 | 49 | 'weather-clouds', | 49 | 'weather-clouds', |
310 | 50 | 'Tomorrow\n257°C/494°F', | 50 | 'Tomorrow\n257°C / 494°F', |
311 | 51 | 'scattered clouds'] | 51 | 'scattered clouds'] |
312 | 52 | results = [] | 52 | results = [] |
313 | 53 | for s in ['query']: | 53 | for s in ['query']: |
From a quick test it looks and works great! :)