~ralsina/ubuntu-rest-scopes/add-missing-lat-long

« back to all changes in this revision

Viewing changes to src/scopes/weatherchannel.py

  • Committer: Tarmac
  • Author(s): Roberto Alsina
  • Date: 2016-03-07 16:14:14 UTC
  • mfrom: (506.1.2 short-digits-vulgarian)
  • Revision ID: tarmac-20160307161414-5d01c52l2rpkg77p
[r=roadmr] Limit lat/long to 2 decimals in search_location to avoid TWC API error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
443
443
    def get_location(self, latitude, longitude):
444
444
        """Return a near address for current location parameters."""
445
445
        # no search string, use geolocation
446
 
        params = dict(lat=latitude, lng=longitude, key=self.auth['api_key'], lang=self.language)
 
446
        params = dict(lat="%.2f" % latitude, lng="%.2f" % longitude,
 
447
                      key=self.auth['api_key'], lang=self.language)
447
448
        loc_uri = self._loc_get_uri % params
448
449
        resp = self.urlread(loc_uri)
449
450