Skip to content

Commit

Permalink
Merge pull request janrueth#296 from boeaja/master
Browse files Browse the repository at this point in the history
fix where am i when not getting postalCode from google map api
  • Loading branch information
Jan authored and Jan committed Feb 18, 2012
2 parents edc49d6 + 00f48ca commit 8ed1d70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/whereAmI.py
Expand Up @@ -35,7 +35,10 @@ def whereAmI(self, speech, language):
components = response['results'][0]['address_components']
street = filter(lambda x: True if "route" in x['types'] else False, components)[0]['long_name']
stateLong= filter(lambda x: True if "administrative_area_level_1" in x['types'] or "country" in x['types'] else False, components)[0]['long_name']
postalCode= filter(lambda x: True if "postal_code" in x['types'] else False, components)[0]['long_name']
try:
postalCode= filter(lambda x: True if "postal_code" in x['types'] else False, components)[0]['long_name']
except:
postalCode=""
try:
city = filter(lambda x: True if "locality" in x['types'] or "administrative_area_level_1" in x['types'] else False, components)[0]['long_name']
except:
Expand Down

0 comments on commit 8ed1d70

Please sign in to comment.