Skip to content

Commit

Permalink
Update fastapi api
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDing committed May 10, 2024
1 parent 4a2d204 commit e81e9b6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions baidupcs_py/commands/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
from typing import Optional, Dict
import sys

if sys.version_info < (3, 9):
from typing_extensions import Annotated
else:
from typing import Annotated

from typing import Optional, Dict, Any
from pathlib import Path
import os
import mimetypes
Expand Down Expand Up @@ -147,14 +154,17 @@ def to_auth(credentials: HTTPBasicCredentials = Depends(_security)) -> str:

def make_auth_http_server(path: str = ""):
@app.get("%s/{remotepath:path}" % path)
async def auth_http_server(username: str = Depends(to_auth), response: Response = Depends(handle_request)):
async def auth_http_server(
username: Annotated[str, Depends(to_auth)], response: Annotated[Any, Depends(handle_request)]
):
# async def auth_http_server(username: str = Depends(to_auth), response: Response = Depends(handle_request)):
if username:
return response


def make_http_server(path: str = ""):
@app.get("%s/{remotepath:path}" % path)
async def http_server(response: Response = Depends(handle_request)):
async def http_server(response: Annotated[Any, Depends(handle_request)]):
return response


Expand Down

0 comments on commit e81e9b6

Please sign in to comment.