Skip to content

test_api_end_point

Created on Fri Jun 27 22:33:36 2025 test api end point @author: anura

is_authorized(req)

check authrizaton

Source code in EMS_template_codes/test_api_end_point.py
18
19
20
21
22
23
24
def is_authorized(req):
    """ check authrizaton"""
    auth_header = req.headers.get('Authorization')
    if not auth_header or not auth_header.startswith("Bearer "):
        return False
    token = auth_header.split(" ")[1]
    return token == EXPECTED_BEARER_TOKEN

🔁 Simulation Flow

flowchart TD
    A[Start main()] --> B[...]

⚙️ Flow with Conditional Checks

flowchart TD
    A[Start main()] --> B{Check something?}
    B -- Yes --> C[Do X]
    B -- No --> D[Exit]