| | |
| | | |
| | | import jwt |
| | | # from cryptography.fernet import Fernet |
| | | from fastapi import FastAPI, Depends, HTTPException |
| | | from fastapi import FastAPI, Depends, HTTPException, Header |
| | | from fastapi.security import OAuth2PasswordBearer |
| | | from passlib.context import CryptContext |
| | | from pydantic import BaseModel |
| | |
| | | # 记录异常信息,但继续处理其他文件 |
| | | 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__": |
| | | |