nicehero commited on
Commit
5bb8c78
·
1 Parent(s): 653ce63
Files changed (1) hide show
  1. main.py +10 -8
main.py CHANGED
@@ -7,21 +7,23 @@ app = FastAPI()
7
 
8
  @app.get("/getVPImage/{path:path}")
9
  async def get_vp_image(path: str):
10
- target_url = f"https://u7leyomozktm-5527.shanghai-01.dayunet.com/getVPImage/{path}"
 
11
  async with httpx.AsyncClient() as client:
12
  response = await client.get(target_url)
13
- return response.text, response.status_code, response.headers.items()
14
 
15
- app.mount("/", StaticFiles(directory="static", html=True), name="static")
16
 
17
- @app.get("/getVPImage/{path:path}")
18
- async def get_vp_image(path: str):
19
- target_url = f"https://u7leyomozktm-5527.shanghai-01.dayunet.com/getVPImage/{path}"
 
20
 
21
  async with httpx.AsyncClient() as client:
22
- response = await client.get(target_url)
23
 
24
- return Response(content=response.content, media_type="image/jpeg", status_code=response.status_code)
 
25
 
26
  @app.post("/log-error")
27
  async def log_error(request: Request):
 
7
 
8
  @app.get("/getVPImage/{path:path}")
9
  async def get_vp_image(path: str):
10
+ target_url = f"https://u7leyomozktm-5527.shanghai-01.dayunet.com/getVPImage/{path}"
11
+
12
  async with httpx.AsyncClient() as client:
13
  response = await client.get(target_url)
 
14
 
15
+ return Response(content=response.content, media_type="image/jpeg", status_code=response.status_code)
16
 
17
+ @app.post("/uploadVPMask/{path:path}")
18
+ async def upload_vp_mask(path: str, request: Request):
19
+ target_url = f"https://u7leyomozktm-5527.shanghai-01.dayunet.com/uploadVPMask/{path}"
20
+ json_data = await request.json()
21
 
22
  async with httpx.AsyncClient() as client:
23
+ response = await client.post(target_url, json=json_data)
24
 
25
+
26
+ return response.text, response.status_code, response.headers.items()
27
 
28
  @app.post("/log-error")
29
  async def log_error(request: Request):