Skip to content

Commit

Permalink
support json/xml according to accept header + add job status links (#58
Browse files Browse the repository at this point in the history
…) + extra job routes (#86) + compliance with ogc api
  • Loading branch information
fmigneault committed Feb 17, 2021
1 parent 8263038 commit 54a2857
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ boto3
# windows fixes until
# https://github.com/celery/billiard/issues/260
# https://github.com/celery/billiard/issues/313
# celery 5 to be released in near future
# celery >=4.4.3 breaks on 'future.utils' import
billiard; sys_platform != "win32"
billiard>3.2,<3.4; sys_platform == "win32"
# celery 5 to be released in near future
# celery >=4.4.3 breaks on 'future.utils' import
celery[mongodb]==4.4.2; sys_platform != "win32"
celery[mongodb]<4; sys_platform == "win32"
cffi
Expand Down
5 changes: 5 additions & 0 deletions weaver/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
LANGUAGE_EN_US,
])

# Languages
LANGUAGE_EN_CA = "en-CA"
LANGUAGE_FR_CA = "fr-CA"
LANGUAGE_EN_US = "en-US"

# Content-Types
# MIME-type nomenclature:
# <type> "/" [x- | <tree> "."] <subtype> ["+" suffix] *[";" parameter=value]
Expand Down
3 changes: 1 addition & 2 deletions weaver/tweens.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# define common Exception classes that won't require this type of conversion
def ows_response_tween(request, handler):
"""Tween that wraps any API request with appropriate dispatch of error conversion to handle formatting."""
exc_log_lvl = logging.WARNING
try:
result = handler(request)
if hasattr(handler, OWS_TWEEN_HANDLED):
Expand All @@ -40,13 +41,11 @@ def ows_response_tween(request, handler):
raised_error = err
return_error = err
exc_info_err = False
exc_log_lvl = logging.WARNING
except NotImplementedError as err:
LOGGER.debug("not implemented error -> ows exception response")
raised_error = err
return_error = OWSNotImplemented(str(err))
exc_info_err = sys.exc_info()
exc_log_lvl = logging.WARNING
except Exception as err:
LOGGER.debug("unhandled %s exception -> ows exception response", type(err).__name__)
raised_error = err
Expand Down
1 change: 0 additions & 1 deletion weaver/wps_restapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def api_swagger_json(request): # noqa: F811
weaver_server_url = get_weaver_url(request)
LOGGER.debug("Request app URL: [%s]", request.url)
LOGGER.debug("Weaver config URL: [%s]", weaver_server_url)
# http_scheme=request.scheme, http_host=request.host
return get_swagger_json(base_url=weaver_server_url, use_docstring_summary=True)


Expand Down
8 changes: 1 addition & 7 deletions weaver/wps_restapi/swagger_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,13 +1014,7 @@ class AlternateQuotationList(ExtendedSequenceSchema):
step = AlternateQuotation(description="Quote of a workflow step process.")


# same as base Format, but for process/job responses instead of process submission
# (ie: 'Format' is for allowed/supported formats, this is the result format)
class DataEncodingAttributes(Format):
pass


class Reference(DataEncodingAttributes):
class Reference(Format):
href = URL(description="Endpoint of the reference.")
body = ExtendedSchemaNode(String(), missing=drop)
bodyReference = URL(missing=drop)
Expand Down

0 comments on commit 54a2857

Please sign in to comment.