MCPcopy Index your code
hub / github.com/googlemaps/google-maps-services-python / make_api_method

Function make_api_method

googlemaps/client.py:432–451  ·  view source on GitHub ↗

Provides a single entry point for modifying all API methods. For now this is limited to allowing the client object to be modified with an `extra_params` keyword arg to each method, that is then used as the params for each web service request. Please note that this is an unsuppo

(func)

Source from the content-addressed store, hash-verified

430from googlemaps.addressvalidation import addressvalidation
431
432def make_api_method(func):
433 """
434 Provides a single entry point for modifying all API methods.
435 For now this is limited to allowing the client object to be modified
436 with an `extra_params` keyword arg to each method, that is then used
437 as the params for each web service request.
438
439 Please note that this is an unsupported feature for advanced use only.
440 It's also currently incompatibile with multiple threads, see GH #160.
441 """
442 @functools.wraps(func)
443 def wrapper(*args, **kwargs):
444 args[0]._extra_params = kwargs.pop("extra_params", None)
445 result = func(*args, **kwargs)
446 try:
447 del args[0]._extra_params
448 except AttributeError:
449 pass
450 return result
451 return wrapper
452
453
454Client.directions = make_api_method(directions)

Callers 1

client.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected