Hello community, here is the log from the commit of package python-geopy for openSUSE:Factory checked in at 2016-03-02 14:21:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-geopy (Old) and /work/SRC/openSUSE:Factory/.python-geopy.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-geopy" Changes: -------- --- /work/SRC/openSUSE:Factory/python-geopy/python-geopy.changes 2015-05-10 10:46:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-geopy.new/python-geopy.changes 2016-03-02 14:21:28.000000000 +0100 @@ -1,0 +2,10 @@ +Thu Feb 18 15:12:48 UTC 2016 - [email protected] + +- update to version 1.11.0: + * ADDED: Photon geocoder. + * ADDED: Bing supports structured query parameters. + * CHANGED: Geocoders send a User-Agent header, which by default is geopy/1.11.0. + * FIXED: Index out of range error with no results using Yandex. + * FIXED: Nominatim was incorrectly sending view_box when not requested, and formatting it incorrectly. + +------------------------------------------------------------------- Old: ---- geopy-1.10.0.tar.gz New: ---- geopy-1.11.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-geopy.spec ++++++ --- /var/tmp/diff_new_pack.dSPXV6/_old 2016-03-02 14:21:29.000000000 +0100 +++ /var/tmp/diff_new_pack.dSPXV6/_new 2016-03-02 14:21:29.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-geopy # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-geopy -Version: 1.10.0 +Version: 1.11.0 Release: 0 Url: http://code.google.com/p/geopy/ Summary: Python Geocoding Toolbox ++++++ geopy-1.10.0.tar.gz -> geopy-1.11.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/PKG-INFO new/geopy-1.11.0/PKG-INFO --- old/geopy-1.10.0/PKG-INFO 2015-04-05 21:23:15.000000000 +0200 +++ new/geopy-1.11.0/PKG-INFO 2015-08-31 16:24:43.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: geopy -Version: 1.10.0 +Version: 1.11.0 Summary: Python Geocoding Toolbox Home-page: https://github.com/geopy/geopy Author: GeoPy Contributors Author-email: uijllji@gmail License: MIT -Download-URL: https://github.com/geopy/geopy/archive/1.10.0.tar.gz +Download-URL: https://github.com/geopy/geopy/archive/1.11.0.tar.gz Description: UNKNOWN Keywords: geocode geocoding gis geographical maps earth distance Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/__init__.py new/geopy-1.11.0/geopy/__init__.py --- old/geopy-1.10.0/geopy/__init__.py 2015-04-05 20:55:30.000000000 +0200 +++ new/geopy-1.11.0/geopy/__init__.py 2015-08-31 16:23:49.000000000 +0200 @@ -11,6 +11,4 @@ from geopy.point import Point from geopy.location import Location from geopy.geocoders import * # pylint: disable=W0401 - - -__version__ = "1.10.0" +from geopy.util import __version__ Files old/geopy-1.10.0/geopy/__init__.pyc and new/geopy-1.11.0/geopy/__init__.pyc differ Files old/geopy-1.10.0/geopy/compat.pyc and new/geopy-1.11.0/geopy/compat.pyc differ Files old/geopy-1.10.0/geopy/distance.pyc and new/geopy-1.11.0/geopy/distance.pyc differ Files old/geopy-1.10.0/geopy/exc.pyc and new/geopy-1.11.0/geopy/exc.pyc differ Files old/geopy-1.10.0/geopy/format.pyc and new/geopy-1.11.0/geopy/format.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/__init__.py new/geopy-1.11.0/geopy/geocoders/__init__.py --- old/geopy-1.10.0/geopy/geocoders/__init__.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/__init__.py 2015-08-31 15:37:19.000000000 +0200 @@ -90,6 +90,7 @@ "LiveAddress", 'Yandex', "What3Words", + "Photon", ) @@ -110,6 +111,7 @@ from geopy.geocoders.what3words import What3Words from geopy.geocoders.yandex import Yandex from geopy.geocoders.ignfrance import IGNFrance +from geopy.geocoders.photon import Photon from geopy.exc import GeocoderNotFound @@ -135,6 +137,7 @@ "what3words": What3Words, "yandex": Yandex, "ignfrance": IGNFrance, + "photon": Photon } Files old/geopy-1.10.0/geopy/geocoders/__init__.pyc and new/geopy-1.11.0/geopy/geocoders/__init__.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/arcgis.py new/geopy-1.11.0/geopy/geocoders/arcgis.py --- old/geopy-1.10.0/geopy/geocoders/arcgis.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/arcgis.py 2015-08-31 16:23:45.000000000 +0200 @@ -29,7 +29,8 @@ def __init__(self, username=None, password=None, referer=None, # pylint: disable=R0913 token_lifetime=60, scheme=DEFAULT_SCHEME, - timeout=DEFAULT_TIMEOUT, proxies=None): + timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None): """ Create a ArcGIS-based geocoder. @@ -63,7 +64,7 @@ :class:`urllib2.ProxyHandler`. """ super(ArcGIS, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) if username or password or referer: if not (username and password and referer): Files old/geopy-1.10.0/geopy/geocoders/arcgis.pyc and new/geopy-1.11.0/geopy/geocoders/arcgis.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/baidu.py new/geopy-1.11.0/geopy/geocoders/baidu.py --- old/geopy-1.10.0/geopy/geocoders/baidu.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/baidu.py 2015-08-31 16:23:45.000000000 +0200 @@ -28,6 +28,7 @@ scheme='http', timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None ): """ Initialize a customized Baidu geocoder using the v2 API. @@ -47,7 +48,7 @@ :class:`urllib2.ProxyHandler`. """ super(Baidu, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) self.api_key = api_key self.scheme = scheme Files old/geopy-1.10.0/geopy/geocoders/baidu.pyc and new/geopy-1.11.0/geopy/geocoders/baidu.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/base.py new/geopy-1.11.0/geopy/geocoders/base.py --- old/geopy-1.10.0/geopy/geocoders/base.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/base.py 2015-08-31 16:23:49.000000000 +0200 @@ -15,6 +15,7 @@ ProxyHandler, URLError, install_opener, + Request, ) from geopy.point import Point from geopy.exc import ( @@ -28,7 +29,7 @@ GeocoderUnavailable, GeocoderParseError, ) -from geopy.util import decode_page +from geopy.util import decode_page, __version__ __all__ = ( @@ -44,6 +45,8 @@ DEFAULT_SCHEME = 'https' DEFAULT_TIMEOUT = 1 DEFAULT_WKID = 4326 +DEFAULT_USER_AGENT = "geopy/%s" % __version__ + ERROR_CODE_MAP = { 400: GeocoderQueryError, @@ -70,7 +73,8 @@ format_string=DEFAULT_FORMAT_STRING, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None ): """ Mostly-common geocoder validation, proxies, &c. Not all geocoders @@ -84,6 +88,7 @@ ) self.proxies = proxies self.timeout = timeout + self.headers = {'User-Agent': user_agent or DEFAULT_USER_AGENT} if self.proxies: install_opener( @@ -128,8 +133,14 @@ """ requester = requester or self.urlopen + if not requester: + req = Request(url=url, headers=self.headers) + else: + # work around for placefinder's use of requests + req = url + try: - page = requester(url, timeout=(timeout or self.timeout), **kwargs) + page = requester(req, timeout=(timeout or self.timeout), **kwargs) except Exception as error: # pylint: disable=W0703 message = ( str(error) if not py3k Files old/geopy-1.10.0/geopy/geocoders/base.pyc and new/geopy-1.11.0/geopy/geocoders/base.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/bing.py new/geopy-1.11.0/geopy/geocoders/bing.py --- old/geopy-1.10.0/geopy/geocoders/bing.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/bing.py 2015-08-31 16:23:45.000000000 +0200 @@ -25,6 +25,14 @@ https://msdn.microsoft.com/en-us/library/ff701715.aspx """ + structured_query_params = { + 'addressLine', + 'locality', + 'adminDistrict', + 'countryRegion', + 'postalCode', + } + def __init__( self, api_key, @@ -32,6 +40,7 @@ scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """Initialize a customized Bing geocoder with location-specific address information and your Bing Maps API key. @@ -62,7 +71,7 @@ .. versionadded:: 0.96 """ - super(Bing, self).__init__(format_string, scheme, timeout, proxies) + super(Bing, self).__init__(format_string, scheme, timeout, proxies, user_agent=user_agent) self.api_key = api_key self.api = "%s://dev.virtualearth.net/REST/v1/Locations" % self.scheme @@ -81,6 +90,10 @@ :param string query: The address or query you wish to geocode. + For a structured query, provide a dictionary whose keys + are one of: `addressLine`, `locality` (city), `adminDistrict` (state), `countryRegion`, or + `postalcode`. + :param bool exactly_one: Return one result or a list of results, if available. @@ -114,10 +127,19 @@ .. versionadded:: 1.4.0 """ - params = { - 'query': self.format_string % query, - 'key': self.api_key - } + if isinstance(query, dict): + params = { + key: val + for key, val + in query.items() + if key in self.structured_query_params + } + params['key'] = self.api_key + else: + params = { + 'query': self.format_string % query, + 'key': self.api_key + } if user_location: params['userLocation'] = ",".join( (str(user_location.latitude), str(user_location.longitude)) Files old/geopy-1.10.0/geopy/geocoders/bing.pyc and new/geopy-1.11.0/geopy/geocoders/bing.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/databc.py new/geopy-1.11.0/geopy/geocoders/databc.py --- old/geopy-1.10.0/geopy/geocoders/databc.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/databc.py 2015-08-31 16:23:45.000000000 +0200 @@ -19,7 +19,7 @@ http://www.data.gov.bc.ca/dbc/geographic/locate/geocoding.page """ - def __init__(self, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None): + def __init__(self, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, user_agent=None): """ Create a DataBC-based geocoder. @@ -35,7 +35,7 @@ :class:`urllib2.ProxyHandler`. """ super(DataBC, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) self.api = '%s://apps.gov.bc.ca/pub/geocoder/addresses.geojson' % self.scheme Files old/geopy-1.10.0/geopy/geocoders/databc.pyc and new/geopy-1.11.0/geopy/geocoders/databc.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/dot_us.py new/geopy-1.11.0/geopy/geocoders/dot_us.py --- old/geopy-1.10.0/geopy/geocoders/dot_us.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/dot_us.py 2015-08-31 16:23:45.000000000 +0200 @@ -33,6 +33,7 @@ format_string=DEFAULT_FORMAT_STRING, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ :param string username: @@ -58,7 +59,7 @@ .. versionadded:: 0.96 """ super(GeocoderDotUS, self).__init__( - format_string=format_string, timeout=timeout, proxies=proxies + format_string=format_string, timeout=timeout, proxies=proxies, user_agent=user_agent ) if username or password: if not (username and password): Files old/geopy-1.10.0/geopy/geocoders/dot_us.pyc and new/geopy-1.11.0/geopy/geocoders/dot_us.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/geocodefarm.py new/geopy-1.11.0/geopy/geocoders/geocodefarm.py --- old/geopy-1.10.0/geopy/geocoders/geocodefarm.py 2015-04-05 20:55:07.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/geocodefarm.py 2015-08-31 16:23:45.000000000 +0200 @@ -26,6 +26,7 @@ format_string=DEFAULT_FORMAT_STRING, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Create a geocoder for GeocodeFarm. @@ -46,7 +47,7 @@ :class:`urllib2.ProxyHandler`. """ super(GeocodeFarm, self).__init__( - format_string, 'https', timeout, proxies + format_string, 'https', timeout, proxies, user_agent=user_agent ) self.api_key = api_key self.format_string = format_string Files old/geopy-1.10.0/geopy/geocoders/geocodefarm.pyc and new/geopy-1.11.0/geopy/geocoders/geocodefarm.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/geonames.py new/geopy-1.11.0/geopy/geocoders/geonames.py --- old/geopy-1.10.0/geopy/geocoders/geonames.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/geonames.py 2015-08-31 16:23:45.000000000 +0200 @@ -31,7 +31,8 @@ country_bias=None, username=None, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None, ): """ :param string country_bias: @@ -52,7 +53,7 @@ .. versionadded:: 0.96 """ super(GeoNames, self).__init__( - scheme='http', timeout=timeout, proxies=proxies + scheme='http', timeout=timeout, proxies=proxies, user_agent=user_agent ) if username == None: raise ConfigurationError( Files old/geopy-1.10.0/geopy/geocoders/geonames.pyc and new/geopy-1.11.0/geopy/geocoders/geonames.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/googlev3.py new/geopy-1.11.0/geopy/geocoders/googlev3.py --- old/geopy-1.10.0/geopy/geocoders/googlev3.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/googlev3.py 2015-08-31 16:23:45.000000000 +0200 @@ -44,7 +44,8 @@ client_id=None, secret_key=None, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Initialize a customized Google geocoder. @@ -58,7 +59,7 @@ .. versionadded:: 0.98.2 :param string domain: Should be the localized Google Maps domain to - connect to. The default is 'maps.google.com', but if you're + connect to. The default is 'maps.googleapis.com', but if you're geocoding address in the UK (for example), you may want to set it to 'maps.google.co.uk' to properly bias results. @@ -80,7 +81,7 @@ .. versionadded:: 0.96 """ super(GoogleV3, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) if client_id and not secret_key: raise ConfigurationError('Must provide secret_key with client_id.') Files old/geopy-1.10.0/geopy/geocoders/googlev3.pyc and new/geopy-1.11.0/geopy/geocoders/googlev3.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/ignfrance.py new/geopy-1.11.0/geopy/geocoders/ignfrance.py --- old/geopy-1.10.0/geopy/geocoders/ignfrance.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/ignfrance.py 2015-08-31 16:23:45.000000000 +0200 @@ -50,6 +50,7 @@ scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Initialize a customized IGN France geocoder. @@ -88,7 +89,7 @@ """ super(IGNFrance, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) # Catch if no api key with username and password Files old/geopy-1.10.0/geopy/geocoders/ignfrance.pyc and new/geopy-1.11.0/geopy/geocoders/ignfrance.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/navidata.py new/geopy-1.11.0/geopy/geocoders/navidata.py --- old/geopy-1.10.0/geopy/geocoders/navidata.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/navidata.py 2015-08-31 16:23:45.000000000 +0200 @@ -29,6 +29,7 @@ domain='api.navidata.pl', timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): """ .. versionadded:: 1.8.0 @@ -49,7 +50,7 @@ """ super(NaviData, self).__init__( - scheme="http", timeout=timeout, proxies=proxies + scheme="http", timeout=timeout, proxies=proxies, user_agent=user_agent ) self.api_key = api_key Files old/geopy-1.10.0/geopy/geocoders/navidata.pyc and new/geopy-1.11.0/geopy/geocoders/navidata.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/opencage.py new/geopy-1.11.0/geopy/geocoders/opencage.py --- old/geopy-1.10.0/geopy/geocoders/opencage.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/opencage.py 2015-08-31 16:23:45.000000000 +0200 @@ -30,6 +30,7 @@ scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Initialize a customized Open Cage Data geocoder. @@ -52,7 +53,7 @@ """ super(OpenCage, self).__init__( - scheme=scheme, timeout=timeout, proxies=proxies + scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent ) self.api_key = api_key @@ -109,9 +110,9 @@ } if bounds: params['bounds'] = bounds - if bounds: + if language: params['language'] = language - if bounds: + if country: params['country'] = country url = "?".join((self.api, urlencode(params))) Files old/geopy-1.10.0/geopy/geocoders/opencage.pyc and new/geopy-1.11.0/geopy/geocoders/opencage.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/openmapquest.py new/geopy-1.11.0/geopy/geocoders/openmapquest.py --- old/geopy-1.10.0/geopy/geocoders/openmapquest.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/openmapquest.py 2015-08-31 16:23:45.000000000 +0200 @@ -29,6 +29,7 @@ scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Initialize an Open MapQuest geocoder with location-specific @@ -60,7 +61,7 @@ .. versionadded:: 0.96 """ super(OpenMapQuest, self).__init__( - format_string, scheme, timeout, proxies + format_string, scheme, timeout, proxies, user_agent=user_agent ) self.api_key = api_key or '' self.api = "%s://open.mapquestapi.com/nominatim/v1/search" \ Files old/geopy-1.10.0/geopy/geocoders/openmapquest.pyc and new/geopy-1.11.0/geopy/geocoders/openmapquest.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/osm.py new/geopy-1.11.0/geopy/geocoders/osm.py --- old/geopy-1.10.0/geopy/geocoders/osm.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/osm.py 2015-08-31 16:23:45.000000000 +0200 @@ -37,12 +37,13 @@ def __init__( self, format_string=DEFAULT_FORMAT_STRING, - view_box=(-180, -90, 180, 90), + view_box=None, country_bias=None, timeout=DEFAULT_TIMEOUT, proxies=None, domain='nominatim.openstreetmap.org', - scheme=DEFAULT_SCHEME + scheme=DEFAULT_SCHEME, + user_agent=None ): # pylint: disable=R0913 """ :param string format_string: String containing '%s' where the @@ -74,18 +75,16 @@ .. versionadded:: 1.8.2 """ super(Nominatim, self).__init__( - format_string, scheme, timeout, proxies + format_string, scheme, timeout, proxies, user_agent=user_agent ) self.country_bias = country_bias self.format_string = format_string self.view_box = view_box - self.country_bias = country_bias self.domain = domain.strip('/') self.api = "%s://%s/search" % (self.scheme, self.domain) self.reverse_api = "%s://%s/reverse" % (self.scheme, self.domain) - def geocode( self, query, @@ -156,11 +155,13 @@ params = {'q': self.format_string % query} params.update({ - # `viewbox` apparently replaces `view_box` - 'viewbox': self.view_box, 'format': 'json' }) + # `viewbox` apparently replaces `view_box` + if self.view_box: + params['viewbox'] = ','.join(self.view_box) + if self.country_bias: params['countrycodes'] = self.country_bias Files old/geopy-1.10.0/geopy/geocoders/osm.pyc and new/geopy-1.11.0/geopy/geocoders/osm.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/photon.py new/geopy-1.11.0/geopy/geocoders/photon.py --- old/geopy-1.10.0/geopy/geocoders/photon.py 1970-01-01 01:00:00.000000000 +0100 +++ new/geopy-1.11.0/geopy/geocoders/photon.py 2015-08-31 16:23:37.000000000 +0200 @@ -0,0 +1,225 @@ +""" +:class:`.Photon` geocoder. +""" + +from geopy.compat import urlencode, string_compare +from geopy.geocoders.base import ( + Geocoder, + DEFAULT_FORMAT_STRING, + DEFAULT_TIMEOUT, + DEFAULT_SCHEME +) +from geopy.location import Location +from geopy.util import logger + + +__all__ = ("Photon", ) + + +class Photon(Geocoder): # pylint: disable=W0223 + """ + Geocoder using Photon geocoding service (data based on OpenStreetMap and + service provided by Komoot on https://photon.komoot.de). + Documentation at https://github.com/komoot/photon + """ + + def __init__( + self, + format_string=DEFAULT_FORMAT_STRING, + scheme=DEFAULT_SCHEME, + timeout=DEFAULT_TIMEOUT, + proxies=None, + domain='photon.komoot.de' + ): # pylint: disable=R0913 + """ + Initialize a Photon/Komoot geocoder which aims to let you "search as + you type with OpenStreetMap". No API Key is needed by this platform. + + :param string format_string: String containing '%s' where + the string to geocode should be interpolated before querying + the geocoder. For example: '%s, Mountain View, CA'. The default + is just '%s'. + + :param string scheme: Use 'https' or 'http' as the API URL's scheme. + Default is https. Note that SSL connections' certificates are not + verified. + + :param int timeout: Time, in seconds, to wait for the geocoding service + to respond before raising a :class:`geopy.exc.GeocoderTimedOut` + exception. + + :param dict proxies: If specified, routes this geocoder's requests + through the specified proxy. E.g., {"https": "192.0.2.0"}. For + more information, see documentation on + :class:`urllib2.ProxyHandler`. + + :param string domain: Should be the localized Photon domain to + connect to. The default is 'photon.komoot.de', but you + can change it to a domain of your own. + """ + super(Photon, self).__init__( + format_string, scheme, timeout, proxies + ) + self.domain = domain.strip('/') + self.api = "%s://%s/api" % (self.scheme, self.domain) + self.reverse_api = "%s://%s/reverse" % (self.scheme, self.domain) + + def geocode( + self, + query, + exactly_one=True, + timeout=None, + location_bias=None, + language=False, + osm_tag=None + ): # pylint: disable=W0221 + """ + Geocode a location query. + + :param string query: The address or query you wish to geocode. + + :param bool exactly_one: Return one result or a list of results, if + available. + + :param int timeout: Time, in seconds, to wait for the geocoding service + to respond before raising a :class:`geopy.exc.GeocoderTimedOut` + exception. Set this only if you wish to override, on this call + only, the value set during the geocoder's initialization. + + :param location_bias: The coordinates to used as location bias. + :type query: :class:`geopy.point.Point`, list or tuple of (latitude, + longitude), or string as "%(latitude)s, %(longitude)s" + + :param string language: Preferred language in which to return results. + + :param osm_tag: The expression to filter (include/exclude) by key and/ + or value, str as 'key:value' or list/set of str if multiple filters + are requiered as ['key:!val', '!key', ':!value'] + + """ + params = { + 'q': self.format_string % query + } + if exactly_one: + params['limit'] = 1 + if language: + params['lang'] = language + if location_bias: + try: + lat, lon = [x.strip() for x + in self._coerce_point_to_string(location_bias) + .split(',')] + params['lon'] = lon + params['lat'] = lat + except ValueError: + raise ValueError(("Location bias must be a" + " coordinate pair or Point")) + if osm_tag: + if isinstance(osm_tag, string_compare): + params['osm_tag'] = osm_tag + else: + try: + params['osm_tag'] = '&osm_tag='.join(osm_tag) + except ValueError: + raise ValueError( + "osm_tag must be a string expression or " + "a set/list of string expressions" + ) + url = "?".join((self.api, urlencode(params))) + + logger.debug("%s.geocode: %s", self.__class__.__name__, url) + return self._parse_json( + self._call_geocoder(url, timeout=timeout), + exactly_one + ) + + def reverse( + self, + query, + exactly_one=True, + timeout=None, + language=False, + osm_tag=None + ): # pylint: disable=W0221 + """ + Returns a reverse geocoded location. + + :param query: The coordinates for which you wish to obtain the + closest human-readable addresses. + :type query: :class:`geopy.point.Point`, list or tuple of (latitude, + longitude), or string as "%(latitude)s, %(longitude)s" + + :param bool exactly_one: Return one result or a list of results, if + available. + + :param int timeout: Time, in seconds, to wait for the geocoding service + to respond before raising a :class:`geopy.exc.GeocoderTimedOut` + exception. Set this only if you wish to override, on this call + only, the value set during the geocoder's initialization. + + :param string language: Preferred language in which to return results. + + :param osm_tag: The expression to filter (include/exclude) by key and/ + or value, str as 'key:value' or list/set of str if multiple filters + are requiered as ['key:!val', '!key', ':!value'] + """ + try: + lat, lon = [x.strip() for x in + self._coerce_point_to_string(query).split(',')] + except ValueError: + raise ValueError("Must be a coordinate pair or Point") + params = { + 'lat': lat, + 'lon': lon, + } + if exactly_one: + params['limit'] = 1 + if language: + params['lang'] = language + if osm_tag: + if isinstance(osm_tag, string_compare): + params['osm_tag'] = osm_tag + else: + try: + params['osm_tag'] = '&osm_tag='.join(osm_tag) + except ValueError: + raise ValueError(("osm_tag must be a string expression or " + "a set/list of string expressions")) + url = "?".join((self.reverse_api, urlencode(params))) + logger.debug("%s.reverse: %s", self.__class__.__name__, url) + return self._parse_json( + self._call_geocoder(url, timeout=timeout), exactly_one + ) + + @classmethod + def _parse_json(cls, resources, exactly_one=True): + """ + Parse display name, latitude, and longitude from a JSON response. + """ + if not len(resources): # pragma: no cover + return None + if exactly_one: + return cls.parse_resource(resources['features'][0]) + else: + return [cls.parse_resource(resource) for resource + in resources['features']] + + @classmethod + def parse_resource(cls, resource): + """ + Return location and coordinates tuple from dict. + """ + name_elements = ['name', 'housenumber', 'street', + 'postcode', 'street', 'city', + 'state', 'country'] + name = [resource.get(k) for k + in name_elements if resource.get(k)] + location = ', '.join(name) + + latitude = resource['geometry']['coordinates'][1] or None + longitude = resource['geometry']['coordinates'][0] or None + if latitude and longitude: + latitude = float(latitude) + longitude = float(longitude) + + return Location(location, (latitude, longitude), resource) Files old/geopy-1.10.0/geopy/geocoders/photon.pyc and new/geopy-1.11.0/geopy/geocoders/photon.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/placefinder.py new/geopy-1.11.0/geopy/geocoders/placefinder.py --- old/geopy-1.10.0/geopy/geocoders/placefinder.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/placefinder.py 2015-08-31 16:23:49.000000000 +0200 @@ -2,8 +2,10 @@ :class:`.YahooPlaceFinder` geocoder. """ +from functools import partial + try: - from requests import get + from requests import get, Request from requests_oauthlib import OAuth1 requests_missing = False except ImportError: @@ -29,7 +31,8 @@ consumer_key, consumer_secret, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ :param string consumer_key: Key provided by Yahoo. @@ -54,7 +57,7 @@ ' Install with `pip install geopy -e ".[placefinder]"`.' ) super(YahooPlaceFinder, self).__init__( - timeout=timeout, proxies=proxies + timeout=timeout, proxies=proxies, user_agent=user_agent ) self.consumer_key = ( unicode(consumer_key) Files old/geopy-1.10.0/geopy/geocoders/placefinder.pyc and new/geopy-1.11.0/geopy/geocoders/placefinder.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/smartystreets.py new/geopy-1.11.0/geopy/geocoders/smartystreets.py --- old/geopy-1.10.0/geopy/geocoders/smartystreets.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/smartystreets.py 2015-08-31 16:23:45.000000000 +0200 @@ -25,7 +25,8 @@ candidates=1, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None, ): # pylint: disable=R0913 """ Initialize a customized SmartyStreets LiveAddress geocoder. @@ -64,7 +65,7 @@ .. versionadded:: 0.96 """ super(LiveAddress, self).__init__( - timeout=timeout, proxies=proxies + timeout=timeout, proxies=proxies, user_agent=user_agent ) if scheme == "http": raise ConfigurationError("LiveAddress now requires `https`.") Files old/geopy-1.10.0/geopy/geocoders/smartystreets.pyc and new/geopy-1.11.0/geopy/geocoders/smartystreets.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/what3words.py new/geopy-1.11.0/geopy/geocoders/what3words.py --- old/geopy-1.10.0/geopy/geocoders/what3words.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/what3words.py 2015-08-31 16:23:45.000000000 +0200 @@ -36,6 +36,7 @@ scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, + user_agent=None, ): """ Initialize a What3Words geocoder with 3-word or OneWord-address and @@ -69,7 +70,8 @@ format_string, scheme, timeout, - proxies + proxies, + user_agent=user_agent, ) self.api_key = api_key self.api = ( Files old/geopy-1.10.0/geopy/geocoders/what3words.pyc and new/geopy-1.11.0/geopy/geocoders/what3words.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/geocoders/yandex.py new/geopy-1.11.0/geopy/geocoders/yandex.py --- old/geopy-1.10.0/geopy/geocoders/yandex.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/geocoders/yandex.py 2015-08-31 16:23:45.000000000 +0200 @@ -27,7 +27,8 @@ api_key=None, lang=None, timeout=DEFAULT_TIMEOUT, - proxies=None + proxies=None, + user_agent=None, ): """ Create a Yandex-based geocoder. @@ -50,7 +51,7 @@ :class:`urllib2.ProxyHandler`. """ super(Yandex, self).__init__( - scheme='http', timeout=timeout, proxies=proxies + scheme='http', timeout=timeout, proxies=proxies, user_agent=user_agent ) self.api_key = api_key self.lang = lang @@ -161,6 +162,9 @@ return Location(location, (latitude, longitude), place) if exactly_one: - return parse_code(places[0]) + try: + return parse_code(places[0]) + except IndexError: + return None else: return [parse_code(place) for place in places] Files old/geopy-1.10.0/geopy/geocoders/yandex.pyc and new/geopy-1.11.0/geopy/geocoders/yandex.pyc differ Files old/geopy-1.10.0/geopy/location.pyc and new/geopy-1.11.0/geopy/location.pyc differ Files old/geopy-1.10.0/geopy/point.pyc and new/geopy-1.11.0/geopy/point.pyc differ Files old/geopy-1.10.0/geopy/units.pyc and new/geopy-1.11.0/geopy/units.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy/util.py new/geopy-1.11.0/geopy/util.py --- old/geopy-1.10.0/geopy/util.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/geopy/util.py 2015-08-31 16:23:57.000000000 +0200 @@ -16,6 +16,9 @@ pass +__version__ = "1.11.0" + + class NullHandler(logging.Handler): """ No output. @@ -80,3 +83,10 @@ else: # requests? encoding = page.headers.get("charset") or "utf-8" return str(page.content, encoding=encoding) + + +def get_version(): + from geopy.version import GEOPY_VERSION + return str(GEOPY_VERSION) + + Files old/geopy-1.10.0/geopy/util.pyc and new/geopy-1.11.0/geopy/util.pyc differ Files old/geopy-1.10.0/geopy/version.pyc and new/geopy-1.11.0/geopy/version.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy.egg-info/PKG-INFO new/geopy-1.11.0/geopy.egg-info/PKG-INFO --- old/geopy-1.10.0/geopy.egg-info/PKG-INFO 2015-04-05 21:23:15.000000000 +0200 +++ new/geopy-1.11.0/geopy.egg-info/PKG-INFO 2015-08-31 16:24:42.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.1 Name: geopy -Version: 1.10.0 +Version: 1.11.0 Summary: Python Geocoding Toolbox Home-page: https://github.com/geopy/geopy Author: GeoPy Contributors Author-email: uijllji@gmail License: MIT -Download-URL: https://github.com/geopy/geopy/archive/1.10.0.tar.gz +Download-URL: https://github.com/geopy/geopy/archive/1.11.0.tar.gz Description: UNKNOWN Keywords: geocode geocoding gis geographical maps earth distance Platform: UNKNOWN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy.egg-info/SOURCES.txt new/geopy-1.11.0/geopy.egg-info/SOURCES.txt --- old/geopy-1.10.0/geopy.egg-info/SOURCES.txt 2015-04-05 21:23:15.000000000 +0200 +++ new/geopy-1.11.0/geopy.egg-info/SOURCES.txt 2015-08-31 16:24:43.000000000 +0200 @@ -21,9 +21,11 @@ geopy/units.pyc geopy/util.py geopy/util.pyc +geopy/version.pyc geopy.egg-info/PKG-INFO geopy.egg-info/SOURCES.txt geopy.egg-info/dependency_links.txt +geopy.egg-info/pbr.json geopy.egg-info/requires.txt geopy.egg-info/top_level.txt geopy/geocoders/__init__.py @@ -56,6 +58,8 @@ geopy/geocoders/openmapquest.pyc geopy/geocoders/osm.py geopy/geocoders/osm.pyc +geopy/geocoders/photon.py +geopy/geocoders/photon.pyc geopy/geocoders/placefinder.py geopy/geocoders/placefinder.pyc geopy/geocoders/smartystreets.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy.egg-info/pbr.json new/geopy-1.11.0/geopy.egg-info/pbr.json --- old/geopy-1.10.0/geopy.egg-info/pbr.json 1970-01-01 01:00:00.000000000 +0100 +++ new/geopy-1.11.0/geopy.egg-info/pbr.json 2015-08-31 16:24:42.000000000 +0200 @@ -0,0 +1 @@ +{"is_release": false, "git_version": "cefd924"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy.egg-info/requires.txt new/geopy-1.11.0/geopy.egg-info/requires.txt --- old/geopy-1.10.0/geopy.egg-info/requires.txt 2015-04-05 21:23:15.000000000 +0200 +++ new/geopy-1.11.0/geopy.egg-info/requires.txt 2015-08-31 16:24:42.000000000 +0200 @@ -1,7 +1,6 @@ +[placefinder] +requests_oauthlib>=0.4.0 [timezone] pytz - -[placefinder] -requests_oauthlib>=0.4.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/geopy.egg-info/top_level.txt new/geopy-1.11.0/geopy.egg-info/top_level.txt --- old/geopy-1.10.0/geopy.egg-info/top_level.txt 2015-04-05 21:23:15.000000000 +0200 +++ new/geopy-1.11.0/geopy.egg-info/top_level.txt 2015-08-31 16:24:42.000000000 +0200 @@ -1,2 +1,2 @@ -test geopy +test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/geopy-1.10.0/setup.py new/geopy-1.11.0/setup.py --- old/geopy-1.10.0/setup.py 2015-04-05 20:54:42.000000000 +0200 +++ new/geopy-1.11.0/setup.py 2015-08-31 16:23:45.000000000 +0200 @@ -10,7 +10,8 @@ TESTS_REQUIRES = [ 'nose-cov', 'pylint', - 'tox' + 'tox', + 'mock' ]
