forked from Quan666/PikPakAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
85 lines (70 loc) · 2 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import asyncio
import json
import httpx
from pikpakapi import PikPakApi
async def test():
client = PikPakApi(
username="your_username",
password="your_password",
httpx_client_args={
"proxy": "http://127.0.0.1:1081",
"transport": httpx.AsyncHTTPTransport(retries=3),
},
)
await client.login()
await client.refresh_access_token()
print(json.dumps(client.get_user_info(), indent=4))
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.offline_download(
"magnet:?xt=urn:btih:42b46b971332e776e8b290ed34632d5c81a1c47c"
),
indent=4,
)
)
print("=" * 30, end="\n\n")
print(json.dumps(await client.offline_list(), indent=4))
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.offline_file_info("VN5omQUMRn5NlHL8lMt91q5Io1"), indent=4
)
)
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.file_rename(
"VNayNjZtsdmka4YrwZWVj-r4o1",
"[Nekomoe kissaten][Deaimon][11][1080p][CHS]_01.mp4",
),
indent=4,
)
)
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.file_batch_star(ids=["VN6qSS-FBcaI6l7YltWsjUU1o1"]), indent=4
)
)
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.file_batch_unstar(ids=["VN6qSS-FBcaI6l7YltWsjUU1o1"]), indent=4
)
)
print("=" * 30, end="\n\n")
print(json.dumps(await client.file_star_list(), indent=4))
print("=" * 30, end="\n\n")
print(
json.dumps(
await client.file_batch_share(
ids=["VN6qSS-FBcaI6l7YltWsjUU1o1"], need_password=True
)
)
)
print("=" * 30, end="\n\n")
print(json.dumps(await client.get_quota_info(), indent=4))
print("=" * 30, end="\n\n")
if __name__ == "__main__":
asyncio.run(test())