geopy.exc: extend more specific built-in exceptions where appropriate: classes
Add Python 3.9 to the list of supported versions.
Yandex: remove attention block about requiring an API key.
geopy 2.0 is a major release with lots of cleanup and inner refactorings. The public interface of the library is mostly the same, and the set of supported geocoders didn’t change.
If you have checked your code on the latest 1.x release with enabled
warnings (i.e. with
-Wd key of the
python command) and fixed
all of them, then it should be safe to upgrade.
There are 3 implementations coming out of the box:
requestslibrary which supports keepalives (thus it is significantly more effective than
urllib). It is used by default if
requestspackage is installed.
urllib, basically it provides the same behavior as in geopy 1.x. It is used by default if
requestspackage is not installed.
RateLimiteris now thread-safe.
geopy.distancealgorithms now raise
ValueErrorfor points with different altitudes, because altitude is ignored in calculations.
timeout=Nonenow disables request timeout, previously a default timeout has been used in this case.
format_stringparam from all geocoders. See Specifying Parameters Once doc section for alternatives.
exactly_one’s default is now
Truefor all geocoders and methods.
Removed service-specific request params from all
__init__methods of geocoders. Pass them to the corresponding
All bounding box arguments now must be passed as a list of two Points. Previously some geocoders accepted unique formats like plain strings and lists of 4 coordinates – these values are not valid anymore.
GoogleV3.reverse_timezone()used to allow numeric
reversemethods used to bypass the query if it couldn’t be parsed as a
Point. Now a
ValueErroris raised in this case.
Pointnow raises a
ValueErrorif constructed from a single number. A zero longitude must be explicitly passed to avoid the error.
Most of the service-specific arguments of geocoders now must be passed as kwargs, positional arguments are not accepted.
parse_*methods in geocoders have been prefixed with
_to explicitly mark that they are private.