Agent-skillset / python /api /csrf_token.py
AUXteam's picture
Upload folder using huggingface_hub
fe69f5e verified
raw
history blame contribute delete
530 Bytes
from python.helpers.api import (
ApiHandler,
Input,
Output,
Request,
Response,
session,
)
from python.helpers import runtime, csrf
class GetCsrfToken(ApiHandler):
@classmethod
def get_methods(cls) -> list[str]:
return ["GET"]
@classmethod
def requires_csrf(cls) -> bool:
return False
async def process(self, input: Input, request: Request) -> Output:
token = csrf.generate_csrf_token()
return {"token": token, "runtime_id": runtime.get_runtime_id()}