Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:58:20

0001 #!/usr/bin/env python
0002 #
0003 # Licensed under the Apache License, Version 2.0 (the "License");
0004 # You may not use this file except in compliance with the License.
0005 # You may obtain a copy of the License at
0006 # http://www.apache.org/licenses/LICENSE-2.0OA
0007 #
0008 # Authors:
0009 # - Wen Guan, <wen.guan@cern.ch>, 2021 - 2022
0010 
0011 
0012 from flask import Blueprint
0013 
0014 # from idds.common import exceptions
0015 from idds.common.constants import HTTP_STATUS_CODE
0016 from idds.rest.v1.controller import IDDSController
0017 
0018 
0019 class Ping(IDDSController):
0020     """ Ping the rest service """
0021 
0022     def get(self):
0023         """ Ping the rest service.
0024         HTTP Success:
0025             200 OK
0026         HTTP Error:
0027             404 Not Found
0028             500 InternalError
0029         :returns: dictionary of an request.
0030         """
0031 
0032         rets = {'Status': 'OK'}
0033         return self.generate_http_response(HTTP_STATUS_CODE.OK, data=rets)
0034 
0035     def post_test(self):
0036         import pprint
0037         pprint.pprint(self.get_request())
0038         pprint.pprint(self.get_request().endpoint)
0039         pprint.pprint(self.get_request().url_rule)
0040 
0041 
0042 """----------------------
0043    Web service url maps
0044 ----------------------"""
0045 
0046 
0047 def get_blueprint():
0048     bp = Blueprint('ping', __name__)
0049 
0050     view = Ping.as_view('ping')
0051     bp.add_url_rule('/ping', view_func=view, methods=['get'])
0052     return bp