Spaces:
Running
Running
rogerxavier
commited on
Commit
•
3078a8c
1
Parent(s):
12c9462
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,33 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
|
3 |
-
import
|
4 |
-
from
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
#通过gradio获取请求
|
3 |
+
from utils import *
|
4 |
+
from login import *
|
5 |
+
import uvicorn
|
6 |
+
from fastapi import FastAPI
|
7 |
+
import gradio as gr
|
8 |
+
app = FastAPI()
|
9 |
+
|
10 |
+
with gr.Blocks() as getCookieStr:
|
11 |
+
# 获取到返回的结果-可以是上传的,可以是查看files信息,也可以是别的
|
12 |
+
someResult = gr.Textbox(label="获取按钮返回信息", type="text")
|
13 |
+
|
14 |
+
get_cookie_btn = gr.Button("获取")
|
15 |
+
# 设置按钮点击事件(获取cookie和响应头截止时间)
|
16 |
+
get_cookie_btn.click(fn=get_cookie_alive_str, inputs=[], outputs=someResult)
|
17 |
+
|
18 |
+
#挂载cookie获取借口
|
19 |
+
app = gr.mount_gradio_app(app, getCookieStr, path="/gr")
|
20 |
+
|
21 |
+
# 通过fid来获取网盘信息->[] 链接+提取码 /None
|
22 |
+
@app.get("/getPanInfo")
|
23 |
+
def getPanInfo(fid:str):
|
24 |
+
session.headers = headers
|
25 |
+
jsonResp = try_puchase(fid=fid, session=session)
|
26 |
+
print(jsonResp)
|
27 |
+
panResult = get_pan_info(fid=fid, session=session) # 每次先尝试购买然后重新打开detail页面查询返回
|
28 |
+
print(panResult)
|
29 |
+
return panResult
|
30 |
+
|
31 |
+
if __name__ == '__main__':
|
32 |
+
uvicorn.run(app, host='0.0.0.0', port=7860)
|
33 |
+
|