Skip to content

Commit

Permalink
Merge pull request #417 from geopy/v2/add-adapters-and-requests
Browse files Browse the repository at this point in the history
geopy 2.0: Add Adapters + RequestsAdapter
  • Loading branch information
KostyaEsmukov committed Jun 21, 2020
2 parents 1307eb8 + 55a5ae8 commit 63202b2
Show file tree
Hide file tree
Showing 39 changed files with 1,024 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ before_install:
- travis_retry pip install -U pip wheel setuptools

install:
- travis_retry pip install -e ".[timezone]"
- travis_retry pip install -e ".[requests,timezone]"

stages:
- lint
Expand Down
21 changes: 21 additions & 0 deletions docs/changelog_2xx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,31 @@ 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.

New features
~~~~~~~~~~~~

- :mod:`geopy.adapters` module. Previously all geocoders used :mod:`urllib`
for HTTP requests, which doesn't support keepalives. Adapters is
a new mechanism which allows to use other HTTP client implementations.

There are 2 implementations coming out of the box:

+ :class:`geopy.adapters.RequestsAdapter` -- uses ``requests`` library
which supports keepalives (thus it is significantly more effective
than ``urllib``). It is used by default if ``requests`` package
is installed.
+ :class:`geopy.adapters.URLLibAdapter` -- uses ``urllib``, basically
it provides the same behavior as in geopy 1.x. It is used by default if
``requests`` package is not installed.


Packaging changes
~~~~~~~~~~~~~~~~~

- Dropped support for Python 2.7 and 3.4.
- New extras:

+ ``geopy[requests]`` for :class:`geopy.adapters.RequestsAdapter`.

Chores
~~~~~~
Expand Down
28 changes: 28 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,34 @@ Exceptions
.. autoclass:: geopy.exc.GeocoderNotFound
:show-inheritance:

Adapters
~~~~~~~~

.. automodule:: geopy.adapters
:members: __doc__

Supported Adapters
------------------

.. autoclass:: geopy.adapters.RequestsAdapter
:show-inheritance:

.. autoclass:: geopy.adapters.URLLibAdapter
:show-inheritance:


Base Classes
------------

.. autoclass:: geopy.adapters.AdapterHTTPError
:show-inheritance:

.. automethod:: __init__

.. autoclass:: geopy.adapters.BaseAdapter
:members:

.. automethod:: __init__

Logging
~~~~~~~
Expand Down

0 comments on commit 63202b2

Please sign in to comment.