Files
notifications-admin/app/status/views/healthcheck.py
Chris Hill-Scott f3a0c505bd Enforce order and style of imports
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```

Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.

Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
    lib1,
    lib2,
    lib3,
    lib4,
)
```

1. https://pypi.python.org/pypi/isort
2018-02-27 16:35:13 +00:00

24 lines
809 B
Python

from flask import current_app, jsonify, request
from notifications_python_client.errors import HTTPError
from app import status_api_client, version
from app.status import status
@status.route('/_status', methods=['GET'])
def show_status():
if request.args.get('elb', None):
return jsonify(status="ok"), 200
else:
try:
api_status = status_api_client.get_status()
except HTTPError as e:
current_app.logger.exception("API failed to respond")
return jsonify(status="error", message=str(e.message)), 500
return jsonify(
status="ok",
api=api_status,
travis_commit=version.__travis_commit__,
travis_build_number=version.__travis_job_number__,
build_time=version.__time__), 200