Spaces:
Running
Running
admin
commited on
Commit
·
738c081
1
Parent(s):
881b442
add check_ms_login
Browse files- modules/activate.py +14 -0
modules/activate.py
CHANGED
@@ -59,6 +59,19 @@ def activate_space(url: str):
|
|
59 |
print(e)
|
60 |
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
def get_studios(username: str):
|
63 |
try:
|
64 |
response = requests.put(
|
@@ -142,6 +155,7 @@ def trigger(users=USERS):
|
|
142 |
activate_space(space)
|
143 |
time.sleep(DELAY)
|
144 |
|
|
|
145 |
for user in tqdm(usernames, desc="Collecting studios"):
|
146 |
username = user.strip()
|
147 |
if username:
|
|
|
59 |
print(e)
|
60 |
|
61 |
|
62 |
+
def check_ms_login():
|
63 |
+
try:
|
64 |
+
response = requests.get(
|
65 |
+
"https://www.modelscope.cn/api/v1/users/login/info",
|
66 |
+
headers=MS_HEADER,
|
67 |
+
timeout=TIMEOUT,
|
68 |
+
)
|
69 |
+
response.raise_for_status()
|
70 |
+
|
71 |
+
except Exception as e:
|
72 |
+
send_email(f"ModelScope cookie 失效: {e}")
|
73 |
+
|
74 |
+
|
75 |
def get_studios(username: str):
|
76 |
try:
|
77 |
response = requests.put(
|
|
|
155 |
activate_space(space)
|
156 |
time.sleep(DELAY)
|
157 |
|
158 |
+
check_ms_login()
|
159 |
for user in tqdm(usernames, desc="Collecting studios"):
|
160 |
username = user.strip()
|
161 |
if username:
|