Skip to content

Commit 01926df

Browse files
committed
CLI: add special -json- output column option
1 parent c6ef1a2 commit 01926df

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Changes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v3.0.4 Mon Dec 30 2024
2+
CLI: Add special 'json' output column option
3+
14
v3.0.3 Sat Nov 9 2024
25
CLI: add 'OpenCage CLI' to the HTTP user agent string
36
Test suite: remove python 3.7, add 3.13

opencage/batch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import traceback
55
import threading
66
import random
7+
import json
78

89
from contextlib import suppress
910
from urllib.parse import urlencode
@@ -221,6 +222,8 @@ async def write_one_geocoding_result(self, csv_output, row_id, geocoding_result,
221222
row.append(self.deep_get_result_value(geocoding_result, ['geometry', column], ''))
222223
elif column == 'FIPS':
223224
row.append(self.deep_get_result_value(geocoding_result, ['annotations', 'FIPS', 'county'], ''))
225+
elif column == 'json':
226+
row.append(json.dumps(geocoding_result, separators=(',', ':'))) # Compact JSON
224227
else:
225228
row.append('')
226229

opencage/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.3'
1+
__version__ = '3.0.4'

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828

2929
setup(
3030
name="opencage",
31-
version="3.0.3",
31+
version="3.0.4",
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="[email protected]",
3737
url="https://github.com/OpenCageData/python-opencage-geocoder/",
38-
download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.0.3",
38+
download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/3.0.4",
3939
license="BSD",
4040
entry_points={
4141
'console_scripts': [

0 commit comments

Comments
 (0)