def servers_status(): """Get KUAS API status for service :resjson list status: Status list (see below) Servers status list :json service: service name. :json status: HTTP status code. **Request** .. sourcecode:: http GET /v2/servers/status HTTP/1.1 Host: kuas.grd.idv.tw:14769 .. sourcecode:: shell curl -X GET https://kuas.grd.idv.tw:14769/v2/servers/status **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "status": [ { "service": "ap", "status": 200 }, { "service": "bus", "status": 200 }, { "service": "leave", "status": 200 } ] } """ try: original_status = cache.server_status() except Exception as err: return error.error_handle(status=404, developer_message=str(err), user_message="Something wrong.") status = { "status": [{ "service": "ap", "status": original_status[0] }, { "service": "bus", "status": original_status[1] }, { "service": "leave", "status": original_status[2] }] } return jsonify(status)
def servers_status(): """Get KUAS API status for service :resjson list status: Status list (see below) Servers status list :json service: service name. :json status: HTTP status code. **Request** .. sourcecode:: http GET /v2/servers/status HTTP/1.1 Host: kuas.grd.idv.tw:14769 .. sourcecode:: shell curl -X GET https://kuas.grd.idv.tw:14769/v2/servers/status **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "status": [ { "service": "ap", "status": 200 }, { "service": "bus", "status": 200 }, { "service": "leave", "status": 200 } ] } """ try: original_status = cache.server_status() except Exception as err: return error.error_handle(status=404, developer_message=str(err), user_message="Something wrong.") status = { "status": [ {"service": "ap", "status": original_status[0]}, {"service": "bus", "status": original_status[1]}, {"service": "leave", "status": original_status[2]} ] } return jsonify(status)
def status(): return json.dumps(cache.server_status())