Skip to content

Commit

Permalink
CLI: add special -json- output column option (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail authored Dec 30, 2024
1 parent c6ef1a2 commit 07d71cb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changes.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions opencage/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import traceback
import threading
import random
import json

from contextlib import suppress
from urllib.parse import urlencode
Expand Down Expand Up @@ -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('')

Expand Down
2 changes: 1 addition & 1 deletion opencage/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.3'
__version__ = '3.0.4'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
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': [
Expand Down

0 comments on commit 07d71cb

Please sign in to comment.