@@ -98,7 +98,6 @@ ENV TZ=${TZ} \
|
||||
python3-greenlet \
|
||||
python3-pip \
|
||||
python3-tz \
|
||||
python3-unicodecsv \
|
||||
python3-yaml \
|
||||
${ADD_DEB_PACKAGES}"
|
||||
|
||||
|
||||
@@ -27,11 +27,10 @@
|
||||
#
|
||||
# =================================================================
|
||||
|
||||
import csv
|
||||
import io
|
||||
import logging
|
||||
|
||||
import unicodecsv as csv
|
||||
|
||||
from pygeoapi.formatter.base import BaseFormatter, FormatterSerializationError
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
@@ -83,10 +82,11 @@ class CSVFormatter(BaseFormatter):
|
||||
# TODO: implement wkt geometry serialization
|
||||
LOGGER.debug('not a point geometry, skipping')
|
||||
|
||||
print("JJJ", fields)
|
||||
LOGGER.debug(f'CSV fields: {fields}')
|
||||
|
||||
try:
|
||||
output = io.BytesIO()
|
||||
output = io.StringIO()
|
||||
writer = csv.DictWriter(output, fields)
|
||||
writer.writeheader()
|
||||
|
||||
@@ -101,7 +101,7 @@ class CSVFormatter(BaseFormatter):
|
||||
LOGGER.error(err)
|
||||
raise FormatterSerializationError('Error writing CSV output')
|
||||
|
||||
return output.getvalue()
|
||||
return output.getvalue().encode('utf-8')
|
||||
|
||||
def __repr__(self):
|
||||
return f'<CSVFormatter> {self.name}'
|
||||
|
||||
@@ -16,4 +16,3 @@ requests
|
||||
shapely
|
||||
SQLAlchemy<2.0.0
|
||||
tinydb
|
||||
unicodecsv
|
||||
|
||||
@@ -578,6 +578,13 @@ def test_get_collection_item(config, api_):
|
||||
assert 'prev' not in feature['links']
|
||||
assert 'next' not in feature['links']
|
||||
|
||||
req = mock_api_request()
|
||||
rsp_headers, code, response = get_collection_item(api_, req, 'norway_pop',
|
||||
'790')
|
||||
feature = json.loads(response)
|
||||
|
||||
assert feature['properties']['name'] == 'Ålesund'
|
||||
|
||||
|
||||
def test_get_collection_item_json_ld(config, api_):
|
||||
req = mock_api_request({'f': 'jsonld'})
|
||||
|
||||
Reference in New Issue
Block a user