Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: add special -json- output column option #60

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading