Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code with black and isort #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions ck_smzdm_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"""


import requests
import hashlib
import json
import time
import hashlib

import requests

from notify_mtr import send
from utils import get_data
Expand All @@ -22,23 +23,30 @@ def __init__(self, check_items):
def sign(cookie):
try:
ts = int(round(time.time() * 1000))
url = 'https://user-api.smzdm.com/robot/token'
url = "https://user-api.smzdm.com/robot/token"
headers = {
'Host': 'user-api.smzdm.com',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': f'{cookie}',
'User-Agent': 'smzdm_android_V10.4.1 rv:841 (22021211RC;Android12;zh)smzdmapp',
"Host": "user-api.smzdm.com",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": f"{cookie}",
"User-Agent": "smzdm_android_V10.4.1 rv:841 (22021211RC;Android12;zh)smzdmapp",
}
data = {
"f": "android",
"v": "10.4.1",
"weixin": 1,
"time": ts,
"sign": hashlib.md5(bytes(f'f=android&time={ts}&v=10.4.1&weixin=1&key=apr1$AwP!wRRT$gJ/q.X24poeBInlUJC', encoding='utf-8')).hexdigest().upper()
"sign": hashlib.md5(
bytes(
f"f=android&time={ts}&v=10.4.1&weixin=1&key=apr1$AwP!wRRT$gJ/q.X24poeBInlUJC",
encoding="utf-8",
)
)
.hexdigest()
.upper(),
}
html = requests.post(url=url, headers=headers, data=data)
res = html.json()
token = res['data']['token']
token = res["data"]["token"]

Timestamp = int(round(time.time() * 1000))
data = {
Expand All @@ -48,24 +56,31 @@ def sign(cookie):
"weixin": 1,
"time": Timestamp,
"token": token,
"sign": hashlib.md5(bytes(f'f=android&sk=ierkM0OZZbsuBKLoAgQ6OJneLMXBQXmzX+LXkNTuKch8Ui2jGlahuFyWIzBiDq/L&time={Timestamp}&token={token}&v=10.4.1&weixin=1&key=apr1$AwP!wRRT$gJ/q.X24poeBInlUJC', encoding='utf-8')).hexdigest().upper()
"sign": hashlib.md5(
bytes(
f"f=android&sk=ierkM0OZZbsuBKLoAgQ6OJneLMXBQXmzX+LXkNTuKch8Ui2jGlahuFyWIzBiDq/L&time={Timestamp}&token={token}&v=10.4.1&weixin=1&key=apr1$AwP!wRRT$gJ/q.X24poeBInlUJC",
encoding="utf-8",
)
)
.hexdigest()
.upper(),
}
url = 'https://user-api.smzdm.com/checkin'
url2 = 'https://user-api.smzdm.com/checkin/all_reward'
url = "https://user-api.smzdm.com/checkin"
url2 = "https://user-api.smzdm.com/checkin/all_reward"
headers = {
'Host': 'user-api.smzdm.com',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': f'{cookie}',
'User-Agent': 'smzdm_android_V10.4.1 rv:841 (22021211RC;Android12;zh)smzdmapp',
"Host": "user-api.smzdm.com",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": f"{cookie}",
"User-Agent": "smzdm_android_V10.4.1 rv:841 (22021211RC;Android12;zh)smzdmapp",
}
html = requests.post(url=url, headers=headers, data=data)
html2 = requests.post(url=url2, headers=headers, data=data)
res = json.loads(html.text)
res2 = json.loads(html2.text)
if res2['error_code'] == '0':
if res2["error_code"] == "0":
msg = res2["title"] + res2["sub_title"]
else:
msg = res['error_msg']
msg = res["error_msg"]
except Exception as e:
msg = f"签到状态: 签到失败\n错误信息: {e},请重新获取 cookie"
return msg
Expand Down