slimkrazy/python-google-places

Add option to add timeout property to `urlopen` call

Opened this issue · 2 comments

When making calls to Google via urlopen:
https://github.com/slimkrazy/python-google-places/blob/master/googleplaces/__init__.py#L68

there's no timeout specified. This means that the call will default to no timeout, or infinite. It would be great to be able to specific a timeout option on a method by method basis, or even a default timeout when instantiating the lib for the first time. Perhaps something like this:

google_places = googleplaces.GooglePlaces(
    settings.GOOGLE_PLACES_API_KEY,
    timeout=2
)

PR #57 has a module constant. You want to update that with your suggestion? Use the constant timeout as default, allowing for the dev to override when they instantiate the top-level object?