程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] automatic update system based on motion step API

編輯:Python

【Python】 Based on the number of motion steps API Automatic update system of

newest :
https://blog.csdn.net/weixin_53403301/article/details/123026380
【V2.0】 Based on the number of motion steps API Automatic update system of ( Support disconnection and reconnection 、 Data compensation )

Adopt millet sport API Realize the modification of wechat steps, etc And added GUI It's done APP You can set the number of steps to update automatically

Resources and APP:
https://download.csdn.net/download/weixin_53403301/80124314

The interface is as shown in the figure ( Packaged as APP):

quote :https://blog.csdn.net/chinaherolts2008/article/details/119921976
https://blog.csdn.net/Jaeger_Java/article/details/109631118

There is no user information when running for the first time , Click remember user , Automatically stored in the program directory “steps.txt” In file , Easy to read next time

The step number range is used to update the step number If the number of steps is not set Or set the minimum number of wrong steps - Maximum value For random updates

Click Update steps You can update the number of steps If not filled Or it is filled in incorrectly Random size

The auto update function needs to set the number of starting steps Number of single steps and number of cycles The default is 0 6 1 namely 0 Step on Every time 3 Second loop 1 Time Co cycle 1 Time Each time 6 Step

Finally, you can set TG Of BOT_TOKEN and USER_ID For pushing Click Set push You can start pushing when the number of steps is updated

After closing the window Turn on terminal mode But the function is much less Only users can be filled in Then fill in the number of steps If you don't fill in Is the random number of steps Pictured :


Demonstration of automatic update function :


During the automatic update process , The step number column will display the current step number result

Set random step update mode The range display can be updated You can also click the update steps directly after filling in The input box will be automatically calibrated :


The code is as follows :

import requests,time,re,json,random
import os
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import *
import tkinter.messagebox
import time
import threading
TG_BOT_TOKEN = "" # telegram bot token Apply for 
TG_USER_ID = "" # telegram user ID
def telegram_bot(title, content):
tg_bot_token = TG_BOT_TOKEN
tg_user_id = TG_USER_ID
if "TG_BOT_TOKEN" in os.environ and "TG_USER_ID" in os.environ:
tg_bot_token = os.environ["TG_BOT_TOKEN"]
tg_user_id = os.environ["TG_USER_ID"]
if not tg_bot_token or not tg_user_id:
print("Telegram Push the TG_BOT_TOKEN perhaps TG_USER_ID Not set !!")
return
print("Telegram Push start ")
send_data = {
"chat_id": tg_user_id, "text": title +
'\n\n'+content, "disable_web_page_preview": "true"}
response = requests.post(
url='https://api.telegram.org/bot%s/sendMessage' % (tg_bot_token), data=send_data)
print(response.text)
now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
headers = {

'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/20.6.18)'
}
# Get login code
def get_code(location):
code_pattern = re.compile("(?<=access=).*?(?=&)")
code = code_pattern.findall(location)[0]
return code
# Sign in 
def login(user,password):
url1 = "https://api-user.huami.com/registrations/+86" + user + "/tokens"
headers = {

"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",
"User-Agent":"MiFit/4.6.0 (iPhone; iOS 14.0.1; Scale/2.00)"
}
data1 = {

"client_id":"HuaMi",
"password":f"{
password}",
"redirect_uri":"https://s3-us-west-2.amazonaws.com/hm-registration/successsignin.html",
"token":"access"
}
r1 = requests.post(url1,data=data1,headers=headers,allow_redirects=False)
location = r1.headers["Location"]
try:
code = get_code(location)
except:
return 0,0
#print("access_code To be successful !")ste
#print(code)
url2 = "https://account.huami.com/v2/client/login"
data2 = {

"app_name":"com.xiaomi.hm.health",
"app_version":"4.6.0",
"code":f"{
code}",
"country_code":"CN",
"device_id":"2C8B4939-0CCD-4E94-8CBA-CB8EA6E613A1",
"device_model":"phone",
"grant_type":"access_token",
"third_name":"huami_phone",
}
r2 = requests.post(url2,data=data2,headers=headers).json()
login_token = r2["token_info"]["login_token"]
#print("login_token To be successful !")
#print(login_token)
userid = r2["token_info"]["user_id"]
#print("userid To be successful !")
#print(userid)
return login_token,userid
# The main function 
def step_main(user, passwd, step, min_num, max_num):
user = str(user)
password = str(passwd)
step = str(step)
if user == '' or password == '':
print (" Incorrect user name or password !")
return
if step == '':
print (" Set to random steps ("+str(min_num)+"-"+str(max_num)+")")
step = str(random.randint(min_num,max_num))
login_token = 0
login_token,userid = login(user,password)
if login_token == 0:
print(" Login failed !")
return "login fail!"
t = get_time()
app_token = get_app_token(login_token)
today = time.strftime("%F")
data_json = '%5B%7B%22data_hr%22%3A%22%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9L%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FVv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0v%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9e%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0n%5C%2Fa%5C%2F%5C%2F%5C%2FS%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0b%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F1FK%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FR%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9PTFFpaf9L%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FR%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0j%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C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AAfgAA%22%2C%22tz%22%3A32%2C%22did%22%3A%22DA932FFFFE8816E7%22%2C%22src%22%3A24%7D%5D%2C%22summary%22%3A%22%7B%5C%22v%5C%22%3A6%2C%5C%22slp%5C%22%3A%7B%5C%22st%5C%22%3A1628296479%2C%5C%22ed%5C%22%3A1628296479%2C%5C%22dp%5C%22%3A0%2C%5C%22lt%5C%22%3A0%2C%5C%22wk%5C%22%3A0%2C%5C%22usrSt%5C%22%3A-1440%2C%5C%22usrEd%5C%22%3A-1440%2C%5C%22wc%5C%22%3A0%2C%5C%22is%5C%22%3A0%2C%5C%22lb%5C%22%3A0%2C%5C%22to%5C%22%3A0%2C%5C%22dt%5C%22%3A0%2C%5C%22rhr%5C%22%3A0%2C%5C%22ss%5C%22%3A0%7D%2C%5C%22stp%5C%22%3A%7B%5C%22ttl%5C%22%3A18272%2C%5C%22dis%5C%22%3A10627%2C%5C%22cal%5C%22%3A510%2C%5C%22wk%5C%22%3A41%2C%5C%22rn%5C%22%3A50%2C%5C%22runDist%5C%22%3A7654%2C%5C%22runCal%5C%22%3A397%2C%5C%22stage%5C%22%3A%5B%7B%5C%22start%5C%22%3A327%2C%5C%22stop%5C%22%3A341%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A481%2C%5C%22cal%5C%22%3A13%2C%5C%22step%5C%22%3A680%7D%2C%7B%5C%22start%5C%22%3A342%2C%5C%22stop%5C%22%3A367%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A368%2C%5C%22stop%5C%22%3A377%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A378%2C%5C%22stop%5C%22%3A386%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A387%2C%5C%22stop%5C%22%3A393%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A394%2C%5C%22stop%5C%22%3A398%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A399%2C%5C%22stop%5C%22%3A414%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A415%2C%5C%22stop%5C%22%3A427%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A428%2C%5C%22stop%5C%22%3A433%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%2C%7B%5C%22start%5C%22%3A434%2C%5C%22stop%5C%22%3A444%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A2295%2C%5C%22cal%5C%22%3A95%2C%5C%22step%5C%22%3A2874%7D%2C%7B%5C%22start%5C%22%3A445%2C%5C%22stop%5C%22%3A455%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1592%2C%5C%22cal%5C%22%3A88%2C%5C%22step%5C%22%3A1664%7D%2C%7B%5C%22start%5C%22%3A456%2C%5C%22stop%5C%22%3A466%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1072%2C%5C%22cal%5C%22%3A51%2C%5C%22step%5C%22%3A1245%7D%2C%7B%5C%22start%5C%22%3A467%2C%5C%22stop%5C%22%3A477%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A1036%2C%5C%22cal%5C%22%3A57%2C%5C%22step%5C%22%3A1124%7D%2C%7B%5C%22start%5C%22%3A478%2C%5C%22stop%5C%22%3A488%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A488%2C%5C%22cal%5C%22%3A19%2C%5C%22step%5C%22%3A607%7D%2C%7B%5C%22start%5C%22%3A489%2C%5C%22stop%5C%22%3A499%2C%5C%22mode%5C%22%3A4%2C%5C%22dis%5C%22%3A2220%2C%5C%22cal%5C%22%3A120%2C%5C%22step%5C%22%3A2371%7D%2C%7B%5C%22start%5C%22%3A500%2C%5C%22stop%5C%22%3A511%2C%5C%22mode%5C%22%3A3%2C%5C%22dis%5C%22%3A1268%2C%5C%22cal%5C%22%3A59%2C%5C%22step%5C%22%3A1489%7D%2C%7B%5C%22start%5C%22%3A512%2C%5C%22stop%5C%22%3A522%2C%5C%22mode%5C%22%3A1%2C%5C%22dis%5C%22%3A152%2C%5C%22cal%5C%22%3A4%2C%5C%22step%5C%22%3A238%7D%5D%7D%2C%5C%22goal%5C%22%3A8000%2C%5C%22tz%5C%22%3A%5C%2228800%5C%22%7D%22%2C%22source%22%3A24%2C%22type%22%3A0%7D%5D'
finddate = re.compile(r'.*?date%22%3A%22(.*?)%22%2C%22data.*?')
findstep = re.compile(r'.*?ttl%5C%22%3A(.*?)%2C%5C%22dis.*?')
data_json = re.sub(finddate.findall(data_json)[0], today, str(data_json))
data_json = re.sub(findstep.findall(data_json)[0], step, str(data_json))
url = f'https://api-mifit-cn.huami.com/v1/data/band_data.json?&t={
t}'
head = {

"apptoken": app_token,
"Content-Type": "application/x-www-form-urlencoded"
}
data = f'userid={
userid}&last_sync_data_time=1597306380&device_type=0&last_deviceid=DA932FFFFE8816E7&data_json={
data_json}'
response = requests.post(url, data=data, headers=head).json()
#print(response)
result = f"{
user[:4]}****{
user[-4:]}: [{
now}] Modify the steps ({
step})"+ response['message']
print(result)
return result
# Get the timestamp 
def get_time():
url = 'http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp'
response = requests.get(url,headers=headers).json()
t = response['data']['t']
return t
# obtain app_token
def get_app_token(login_token):
url = f"https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token={
login_token}"
response = requests.get(url,headers=headers).json()
app_token = response['token_info']['app_token']
#print("app_token To be successful !")
#print(app_token)
return app_token
def gui_start():
root=Tk()
root.title(" Millet sports API")
mainfram=Frame(root,width=320, height=660)
mainfram.grid_propagate(0)
mainfram.grid()
labelName=tkinter.Label(root, text=' user name :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=10, width=80, height=40)
labelName=tkinter.Label(root, text=' password :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=50, width=80, height=40)
labelName=tkinter.Label(root, text=' Step range :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=130, width=80, height=40)
labelName=tkinter.Label(root, text=' to ', justify=tkinter.RIGHT, width=80)
labelName.place(x=180, y=130, width=40, height=40)
labelName=tkinter.Label(root, text=' They count :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=210, width=80, height=40)
labelName=tkinter.Label(root, text=' Auto update start :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=290, width=80, height=40)
labelName=tkinter.Label(root, text=' Number of single steps (N):', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=330, width=80, height=40)
labelName=tkinter.Label(root, text=' cycles :', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=370, width=80, height=40)
labelName=tkinter.Label(root, text='BOT_TOKEN:', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=490, width=80, height=40)
labelName=tkinter.Label(root, text='USER_ID:', justify=tkinter.RIGHT, width=80)
labelName.place(x=10, y=530, width=80, height=40)
user = ""
passwd = ""
step = ""
auto_step = 0
auto_loops = 1
auto_solo = 6
min_num = 20000
max_num = 29999
global auto_flag
auto_flag = 1
global TG_flag
TG_flag = 1
f0 = open("steps.txt", 'a')
f0.close()
f1 = open("steps.txt", 'r')
users=[]
for line in f1.readlines():
users.append(line)
if len(users)>0:
user = (users[0].split("\n")[0])
if len(users)>1:
passwd = (users[1].split("\n")[0])
f1.close()
e1 = Entry(mainfram)
#e1.grid(ipadx=50,row=0,column=1)
e1.delete(0, END) # Clear the contents of the input box 
e1.insert(0, user)
e1.place(x=100, y=10, width=200, height=40)
e2 = Entry(mainfram)
#e2.grid(ipadx=50,row=1,column=1)
e2.delete(0, END) # Clear the contents of the input box 
e2.insert(0, passwd)
e2.place(x=100, y=50, width=200, height=40)
e3 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e3.delete(0, END) # Clear the contents of the input box 
e3.insert(0, " Random steps ("+str(min_num)+"-"+str(max_num)+")")
e3.place(x=100, y=210, width=200, height=40)
e4 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e4.delete(0, END) # Clear the contents of the input box 
e4.insert(0, str(min_num))
e4.place(x=100, y=130, width=80, height=40)
e5 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e5.delete(0, END) # Clear the contents of the input box 
e5.insert(0, str(max_num))
e5.place(x=220, y=130, width=80, height=40)
e6 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e6.delete(0, END) # Clear the contents of the input box 
e6.insert(0, str(auto_step))
e6.place(x=100, y=290, width=200, height=40)
e7 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e7.delete(0, END) # Clear the contents of the input box 
e7.insert(0, " The default is :"+str(auto_loops)+", About N Step /3s A cycle ")
e7.place(x=100, y=370, width=200, height=40)
e8 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e8.delete(0, END) # Clear the contents of the input box 
e8.insert(0, " The default is :"+str(auto_solo)+", One cycle is about 3s")
e8.place(x=100, y=330, width=200, height=40)
e9 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e9.delete(0, END) # Clear the contents of the input box 
e9.insert(0, str(TG_BOT_TOKEN))
e9.place(x=100, y=490, width=200, height=40)
e10 = Entry(mainfram)
# e3.grid(ipadx=50,row=3,column=0)
e10.delete(0, END) # Clear the contents of the input box 
e10.insert(0, str(TG_USER_ID))
e10.place(x=100, y=530, width=200, height=40)
def start():
global TG_flag
user = str(e1.get())
passwd = str(e2.get())
try:
step = str(int(float(e3.get())))
except:
step = ""
try:
min_num_tem = int(float(e4.get()))
max_num_tem = int(float(e5.get()))
if min_num_tem < max_num_tem:
min_num = int(min_num_tem)
max_num = int(max_num_tem)
else:
min_num = 20000
max_num = 29999
except:
min_num = 20000
max_num = 29999
e3.delete(0, END) # Clear the contents of the input box 
e3.insert(0, str(step))
if step == "":
e3.delete(0, END) # Clear the contents of the input box 
e3.insert(0, " Random steps ("+str(min_num)+"-"+str(max_num)+")")
user_list = user.split('#')
passwd_list = passwd.split('#')
setp_array = step.split('-')
if len(user_list) == len(passwd_list):
push = ''
for line in range(0,len(user_list)):
if len(setp_array) == 2:
step = str(random.randint(int(setp_array[0]),int(setp_array[1])))
elif str(step) == '0':
step = ''
push += step_main(user_list[line], passwd_list[line], step, min_num, max_num) + '\n'
if TG_flag == 0:
thread2 = threading.Thread(target=telegram_bot(" Millet sports ", push))
thread2.start()
else:
TG_flag = 1
else:
print(' Incorrect number of user names and passwords ')
def save_user():
user = str(e1.get())
passwd = str(e2.get())
f2 = open("steps.txt", 'w')
f2.write(str(user))
f2.write("\n")
f2.write(str(passwd))
f2.write("\n")
f2.close()
def save_random():
try:
min_num_tem = int(float(e4.get()))
max_num_tem = int(float(e5.get()))
if min_num_tem < max_num_tem:
min_num = int(min_num_tem)
max_num = int(max_num_tem)
else:
min_num = 20000
max_num = 29999
except:
min_num = 20000
max_num = 29999
e3.delete(0, END) # Clear the contents of the input box 
e3.insert(0, " Random steps ("+str(min_num)+"-"+str(max_num)+")")
def auto_step():
global auto_flag
global TG_flag
if auto_flag==0:
try:
auto_loops = int(float(e7.get()))
except:
auto_loops = 1
print(" Total number of cycles :"+str(auto_loops))
try:
auto_step = int(float(e6.get()))
except:
auto_step = 0
print(" Starting steps :"+str(auto_step))
try:
auto_solo = int(float(e8.get()))
except:
auto_solo = 6
print(" Number of single steps :"+str(auto_solo))
for j in range(0,auto_loops):
auto_step = auto_step + auto_solo
user = str(e1.get())
passwd = str(e2.get())
step = str(auto_step)
user_list = user.split('#')
passwd_list = passwd.split('#')
setp_array = step.split('-')
if len(user_list) == len(passwd_list):
push = ''
for line in range(0,len(user_list)):
if len(setp_array) == 2:
step = str(random.randint(int(setp_array[0]),int(setp_array[1])))
elif str(step) == '0':
step = ''
push += step_main(user_list[line], passwd_list[line], step, min_num, max_num) + '\n'
if TG_flag == 0:
thread2 = threading.Thread(target=telegram_bot(" Millet sports ", push))
thread2.start()
else:
TG_flag = 1
else:
print(' Incorrect number of user names and passwords ')
print(" Steps updated automatically :"+str(auto_step))
e3.delete(0, END) # Clear the contents of the input box 
e3.insert(0, str(auto_step))
print(" Number of cycles :"+str(j+1))
if auto_flag == 1:
break
else:
auto_flag=0
time.sleep(1)
print(" End of automatic update ")
def start_thread():
thread0 = threading.Thread(target=start)
thread0.start()
def auto_thread():
global auto_flag
auto_flag=0
thread1 = threading.Thread(target=auto_step)
thread1.start()
def auto_close():
global auto_flag
auto_flag=1
print(" Turning off automatic updates ")
def TG_set():
global TG_BOT_TOKEN
global TG_USER_ID
global TG_flag
TG_flag=0
TG_BOT_TOKEN=e9.get()
TG_USER_ID=e10.get()
print(" Push... Has been set ")
def TG_close():
global TG_BOT_TOKEN
global TG_USER_ID
global TG_flag
TG_flag=1
TG_BOT_TOKEN=""
TG_USER_ID=""
print(" Push turned off ")
button0=Button(mainfram,width=30,text=" Remember users ",command=save_user).place(x=100, y=90, width=200, height=40)
button1=Button(mainfram,width=30,text=" Update steps ",command=start_thread).place(x=100, y=250, width=200, height=40)
button2=Button(mainfram,width=30,text=" Update random step range display ",command=save_random).place(x=100, y=170, width=200, height=40)
button3=Button(mainfram,width=30,text=" Auto update steps ",command=auto_thread).place(x=100, y=410, width=200, height=40)
button4=Button(mainfram,width=30,text=" Turn off automatic updates ",command=auto_close).place(x=100, y=450, width=200, height=40)
button5=Button(mainfram,width=30,text=" Set push ",command=TG_set).place(x=100, y=570, width=200, height=40)
button6=Button(mainfram,width=30,text=" Turn off push ",command=TG_close).place(x=100, y=610, width=200, height=40)
root.mainloop()
def normal_start():
# user name ( The format of a single user is 13800138000 , Multi user # separate , for example 13800138000#13800138000#13800138000)
user = input(" user name :")
# The login password ( use # separate , for example 123456#123456#123456)
passwd = input(" password :")
# Number of steps to modify , Directly enter the step value you want to modify , Leave blank for random steps 20000 to 29999 Between 
step = input(" They count ( The default is 20000-29999 The random number ):")
min_num = 20000
max_num = 29999
user_list = user.split('#')
passwd_list = passwd.split('#')
setp_array = step.split('-')
if len(user_list) == len(passwd_list):
push = ''
for line in range(0,len(user_list)):
if len(setp_array) == 2:
step = str(random.randint(int(setp_array[0]),int(setp_array[1])))
elif str(step) == '0':
step = ''
push += step_main(user_list[line], passwd_list[line], step, min_num, max_num) + '\n'
telegram_bot(" Millet sports ", push)
else:
print(' Incorrect number of user names and passwords ')
if __name__ == "__main__":
print(" A window has been opened ")
gui_start()
print(" Closed window , And turn on the terminal mode ")
while True:
normal_start()
normal_flag = input(" Whether or not to continue (Y/N)?:")
if normal_flag == "N":
print(" Program end ")
break
if normal_flag == "Y":
print(" The program continues ")
else:
print(" Program end ")
break

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved