| | |
| | | from urllib.parse import urlencode |
| | | |
| | | import jwt |
| | | from cryptography.fernet import Fernet |
| | | from fastapi import FastAPI, Depends, HTTPException |
| | | # from cryptography.fernet import Fernet |
| | | from fastapi import FastAPI, Depends, HTTPException, Header |
| | | from fastapi.security import OAuth2PasswordBearer |
| | | from passlib.context import CryptContext |
| | | from pydantic import BaseModel |
| | | from starlette import status |
| | | from starlette.websockets import WebSocket, WebSocketDisconnect |
| | | |
| | | from Log import logger |
| | | # from app.models.app_model import AppRegisterModel |
| | | from app.models.user_model import UserModel |
| | | from app.service.auth import SECRET_KEY, ALGORITHM |
| | | from app.config.config import settings |
| | |
| | | |
| | | pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") |
| | | oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") |
| | | cipher_suite = Fernet(settings.HASH_SUB_KEY) |
| | | # cipher_suite = Fernet(settings.HASH_SUB_KEY) |
| | | |
| | | |
| | | class Response(BaseModel): |
| | |
| | | except Exception as e: |
| | | # 记录异常信息,但继续处理其他文件 |
| | | print(f"Error processing file URL: {e}") |
| | | |
| | | def get_api_key(authorization: str = Header(...)): |
| | | if not authorization.startswith("Bearer "): |
| | | raise HTTPException(status_code=401, detail="Invalid Authorization header format.") |
| | | return authorization.split(" ")[1] |
| | | |
| | | |
| | | |
| | | if __name__=="__main__": |
| | | |
| | | files1 = [{"file_url": "aaa.com"}, {"file_url":"bbb.com"}] |