diff --git a/Changes.txt b/Changes.txt index fd355ad..97a0801 100644 --- a/Changes.txt +++ b/Changes.txt @@ -1,3 +1,6 @@ +v3.0.4 Mon Dec 30 2024 + CLI: Add special 'json' output column option + v3.0.3 Sat Nov 9 2024 CLI: add 'OpenCage CLI' to the HTTP user agent string Test suite: remove python 3.7, add 3.13 diff --git a/opencage/batch.py b/opencage/batch.py index b38f252..609a1ab 100644 --- a/opencage/batch.py +++ b/opencage/batch.py @@ -4,6 +4,7 @@ import traceback import threading import random +import json from contextlib import suppress from urllib.parse import urlencode @@ -221,6 +222,8 @@ async def write_one_geocoding_result(self, csv_output, row_id, geocoding_result, row.append(self.deep_get_result_value(geocoding_result, ['geometry', column], '')) elif column == 'FIPS': row.append(self.deep_get_result_value(geocoding_result, ['annotations', 'FIPS', 'county'], '')) + elif column == 'json': + row.append(json.dumps(geocoding_result, separators=(',', ':'))) # Compact JSON else: row.append('') diff --git a/opencage/version.py b/opencage/version.py index d298347..9a8a1b1 100644 --- a/opencage/version.py +++ b/opencage/version.py @@ -1 +1 @@ -__version__ = '3.0.3' +__version__ = '3.0.4' diff --git a/setup.py b/setup.py index 6546012..1d6b1b9 100644 --- a/setup.py +++ b/setup.py @@ -28,14 +28,14 @@ setup( name="opencage", - version="3.0.3", + version="3.0.4", description="Wrapper module for the OpenCage Geocoder API", long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', author="OpenCage GmbH", author_email="info@opencagedata.com", url="https://github.com/OpenCageData/python-opencage-geocoder/", - download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.0.3", + download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.0.4", license="BSD", entry_points={ 'console_scripts': [