Skip to content

Commit 833dc1c

Browse files
committed
version 2.0
1 parent 406762b commit 833dc1c

5 files changed

Lines changed: 28 additions & 5 deletions

File tree

Changes.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
v2.0.0 Thu 15 Jul 2021
2+
Python 2 no longer supported
3+
New geocode_async and reverse_geocode_async methods
4+
You can now reuse HTTP connections for multiple requests by using a `with` block
5+
Updated examples/batch.py using asyncronous/parallel requests, much faster
6+
Mayor refactor of test suite
7+
Some tests now run against the live API endpoint using test API keys
8+
19
v1.2.2 Tue 3 Nov 2020
210
Test on Python 3.9
311

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ A Python module to access the [OpenCage Geocoder](https://opencagedata.com/).
55

66
## Build Status / Code Quality / etc
77

8-
[![PyPI version](https://badge.fury.io/py/opencage.svg)](https://badge.fury.io/py/opencage)
98
[![Downloads](https://pepy.tech/badge/opencage/month)](https://pepy.tech/project/opencage)
109
[![Versions](https://img.shields.io/pypi/pyversions/opencage)](https://pypi.org/project/opencage/)
1110
![GitHub contributors](https://img.shields.io/github/contributors/opencagedata/python-opencage-geocoder)
@@ -79,6 +78,20 @@ with OpenCageGeocode(key) as geocoder:
7978
results = [geocoder.geocode(query) for query in queries]
8079
```
8180

81+
### Asycronous requests
82+
83+
You can run requests in parallel with the `geocode_async` and `reverse_geocode_async`
84+
method which have the same parameters and response as their synronous counterparts.
85+
You will need at least Python 3.7 and the `asyncio` and `aiohttp` packages installed.
86+
87+
```python
88+
async with OpenCageGeocode(key) as geocoder:
89+
results = await geocoder.geocode_async(address)
90+
```
91+
92+
For a more complete example and links to futher tutorials on asycronous IO see
93+
`batch.py` in the `examples` directory.
94+
8295
### Exceptions
8396

8497
If anything goes wrong, then an exception will be raised:

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if sys.version_info < (3, 5):
1717
raise RuntimeError(
1818
"openage requires Python 3.6 or newer"
19-
"Use older operncage 1.x for Python 2.7 or 3.5"
19+
"Use older opencage 1.x for Python 2.7 or 3.5"
2020
)
2121

2222
# try for travis
@@ -28,14 +28,14 @@
2828

2929
setup(
3030
name="opencage",
31-
version="1.2.2",
31+
version="2.0.0",
3232
description="Wrapper module for the OpenCage Geocoder API",
3333
long_description=long_description,
3434
long_description_content_type='text/markdown',
3535
author="OpenCage GmbH",
3636
author_email="info@opencagedata.com",
3737
url="https://github.com/OpenCageData/python-opencage-geocoder/",
38-
download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/1.2.2",
38+
download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/2.0.0",
3939
license="BSD",
4040
packages=find_packages(),
4141
include_package_data=True,

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py3613, py3710, py38, py39, lint
2+
envlist = py3613, py3710, py38, py3920, lint
33

44
[testenv]
55
deps =

vagrant-provision.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ eval "$(pyenv init -)"
1313
eval "$(pyenv virtualenv-init -)"
1414
' >> ~/.bashrc
1515
source ~/.bashrc
16+
exec $SHELL
1617

1718
for VERSION in 3.6.13 3.7.10 3.8.8 3.9.2; do
1819
pyenv install --skip-existing $VERSION
1920
pyenv global $VERSION
2021
done
2122

23+
sudo apt-get install -y python3-pip
2224
# Python 3.8 has conflicts with upstream Ubuntu and removed distutils from base
2325
# installation, now add a global one back
2426
sudo apt-get install --no-install-recommends -q -y python3-distutils

0 commit comments

Comments
 (0)