Uses **kwargs for geocodeAddress

This commit is contained in:
Guido Fioravantti 2015-11-04 11:41:06 +01:00
parent 1a21dda52a
commit 4a55223ec7

View File

@ -1,4 +1,3 @@
import inspect
import json import json
import urllib import urllib
@ -70,25 +69,10 @@ class Geocoder:
return response return response
def geocodeAddress(self, def geocodeAddress(self, **kwargs):
searchtext=None,
city=None,
country=None,
county=None,
district=None,
housenumber=None,
postalcode=None,
state=None,
street=None):
frame = inspect.currentframe()
keys, _, _, values = inspect.getargvalues(frame)
iterableKeys = iter(keys)
next(iterableKeys)
params = {} params = {}
for key in iterableKeys: for key, value in kwargs.iteritems():
if values[key]: params[key] = values[key] if value: params[key] = value
if not params: raise NoGeocodingParams() if not params: raise NoGeocodingParams()