2023-01-10 12:12:01 -05:00
|
|
|
"""
|
|
|
|
Uptime
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Project Author name guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
|
|
|
|
import datetime
|
|
|
|
import json
|
2023-01-23 12:29:41 -05:00
|
|
|
|
2023-01-10 12:12:01 -05:00
|
|
|
from flask import Response
|
|
|
|
from flask_restful import Resource
|
|
|
|
|
|
|
|
import hub_api.helpers.session_helper as sh
|
|
|
|
|
2023-02-09 09:45:25 -05:00
|
|
|
headers = {'Content-Type': 'application/json'}
|
2023-01-10 12:12:01 -05:00
|
|
|
|
|
|
|
class Uptime(Resource):
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get():
|
|
|
|
uptime = {"uptime": f"{datetime.datetime.now() - sh.begin_time}"}
|
2023-02-09 09:45:25 -05:00
|
|
|
return Response(response=json.dumps(uptime), headers=headers)
|