Skip to content

Commit

Permalink
#118 Error handling list when using geocode as method
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Mar 2, 2015
1 parent 61627e7 commit 053aba3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion geocoder/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def get(location, **kwargs):
'geocode': Here,
'reverse': HereReverse,
},
'nokia': {'geocode': Here},
'baidu': {'geocode': Baidu},
'yahoo': {'geocode': Yahoo},
'tomtom': {'geocode': Tomtom},
Expand Down Expand Up @@ -84,6 +83,10 @@ def get(location, **kwargs):
'elevation': Elevation,
},
}
if isinstance(location, (list, dict)) and method == 'geocode':
print('[ERROR] Please provide a string as the location.\n'
'>>> g = geocoder.get("Ottawa ON", provider="google")')
sys.exit()
if not provider in options:
print('[ERROR] Please provide a correct provider\n'
'Ex: google, bing, osm, here, opencage, tomtom, mapquest\n'
Expand Down

0 comments on commit 053aba3

Please sign in to comment.