New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

python-google-places

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-google-places - pypi Package Compare versions

Comparing version
1.3.1
to
1.4.0
+45
-13
googleplaces/__init__.py

@@ -38,3 +38,3 @@ """

'geocode_location']
__version__ = '1.3.1'
__version__ = '1.4.0'
__author__ = 'Samuel Adu'

@@ -53,3 +53,6 @@ __email__ = 'sam@slimkrazy.com'

def _fetch_remote(service_url, params={}, use_http_post=False):
def _fetch_remote(service_url, params=None, use_http_post=False):
if not params:
params = {}
encoded_data = {}

@@ -72,4 +75,7 @@ for k, v in params.items():

def _fetch_remote_json(service_url, params={}, use_http_post=False):
def _fetch_remote_json(service_url, params=None, use_http_post=False):
"""Retrieves a JSON object from a URL."""
if not params:
params = {}
request_url, response = _fetch_remote(service_url, params, use_http_post)

@@ -81,3 +87,3 @@ if six.PY3:

def _fetch_remote_file(service_url, params={}, use_http_post=False):
def _fetch_remote_file(service_url, params=None, use_http_post=False):
"""Retrieves a file from a URL.

@@ -87,2 +93,5 @@

"""
if not params:
params = {}
request_url, response = _fetch_remote(service_url, params, use_http_post)

@@ -228,7 +237,7 @@ dummy, params = cgi.parse_header(

lat_lng=None, name=None, radius=3200, rankby=ranking.PROMINENCE,
sensor=False, type=None, types=[]):
sensor=False, type=None, types=[], pagetoken=None):
"""Perform a nearby search using the Google Places API.
One of either location or lat_lng are required, the rest of the keyword
arguments are optional.
One of either location, lat_lng or pagetoken are required, the rest of
the keyword arguments are optional.

@@ -259,5 +268,9 @@ keyword arguments:

will be send as type param.
pagetoken-- Optional parameter to force the search result to return the next
20 results from a previously run search. Setting this parameter
will execute a search with the same parameters used previously.
(default None)
"""
if location is None and lat_lng is None:
raise ValueError('One of location or lat_lng must be passed in.')
if location is None and lat_lng is None and pagetoken is None:
raise ValueError('One of location, lat_lng or pagetoken must be passed in.')
if rankby == 'distance':

@@ -290,2 +303,4 @@ # As per API docs rankby == distance:

self._request_params['name'] = name
if pagetoken is not None:
self._request_params['pagetoken'] = pagetoken
if language is not None:

@@ -299,8 +314,8 @@ self._request_params['language'] = language

def text_search(self, query, language=lang.ENGLISH, lat_lng=None,
radius=3200, type=None, types=[], location=None):
def text_search(self, query=None, language=lang.ENGLISH, lat_lng=None,
radius=3200, type=None, types=[], location=None, pagetoken=None):
"""Perform a text search using the Google Places API.
Only the query kwarg is required, the rest of the keyword arguments
are optional.
Only the one of the query or pagetoken kwargs are required, the rest of the
keyword arguments are optional.

@@ -312,2 +327,6 @@ keyword arguments:

(default None)
pagetoken-- Optional parameter to force the search result to return the next
20 results from a previously run search. Setting this parameter
will execute a search with the same parameters used previously.
(default None)
radius -- The radius (in meters) around the location/lat_lng to

@@ -337,2 +356,4 @@ restrict the search to. The maximum is 50000 meters.

self._request_params['language'] = language
if pagetoken is not None:
self._request_params['pagetoken'] = pagetoken
self._add_required_param_keys()

@@ -771,2 +792,3 @@ url, places_response = _fetch_remote_json(

self._html_attributions = response.get('html_attributions', [])
self._next_page_token = response.get('next_page_token', [])

@@ -795,2 +817,7 @@ @property

@property
def next_page_token(self):
"""Returns the next page token(next_page_token)."""
return self._next_page_token
@property
def has_attributions(self):

@@ -800,2 +827,7 @@ """Returns a flag denoting if the response had any html attributions."""

@property
def has_next_page_token(self):
"""Returns a flag denoting if the response had a next page token."""
return len(self.next_page_token) > 0
def __repr__(self):

@@ -802,0 +834,0 @@ """ Return a string representation stating the number of results."""

Metadata-Version: 1.0
Name: python-google-places
Version: 1.3.1
Version: 1.4.0
Summary: A simple wrapper around the Google Places API.

@@ -5,0 +5,0 @@ Home-page: http://github.com/slimkrazy/python-google-places