#-*-coding:GBK -*-
import os
import winreg #操作注册表
import re
import sys
from tkinter import *
from win32gui import *
import tkinter as tk
import tkinter.messagebox as msg
import win32gui,win32api,win32con
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support.ui import WebDriverWait
import requests
from datetime import datetime
import threading #多线程
import configparser
from datetime import datetime, timedelta
import ctypes #隐藏控制台库
import shelve# 保存变量
def hideConsole(): #隐藏控制台
"""
Hides the console window in GUI mode. Necessary for frozen application, because
this application support both, command line processing AND GUI mode and theirfor
cannot be run via pythonw.exe.
"""
whnd = ctypes.windll.kernel32.GetConsoleWindow()
if whnd != 0:
ctypes.windll.user32.ShowWindow(whnd, 0)
# if you wanted to close the handles...
#ctypes.windll.kernel32.CloseHandle(whnd)
hideConsole()#隐藏控制台
def key360(): #获取360浏览器位置
UnInsKey360 = '360SeSESshellopencommand'
key360 = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, UnInsKey360)
name,value,type = winreg.EnumValue(key360,0) #注册表键名,键值,数据类型
num = re.findall(r"(.+?)360se.exe",value)
num = num[0]+'360se.exe'
return(num)
def test(content): #输入框内容限定为数字
# 如果不加上==""的话,就会发现删不完。总会剩下一个数字
if content.isdigit() or content == "":
return True
else:
return False
def thread_it(func, *args):
'''将函数打包进线程'''
# 创建
t = threading.Thread(target=func, args=args)
# 守护 !!!
t.setDaemon(True)
# 启动
t.start()
# 阻塞--卡死界面!
# t.join()
def time_server():
# 获取淘宝服务器的时间戳
r1 = requests.get(url='http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp',
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36'}
).json()['data']['t']
# 把时间戳格式/1000 获取毫秒
timeNum = int(r1) / 1000
# 格式化时间 (小数点后6为)
time1 = datetime.fromtimestamp(timeNum)
return time1
def time_server1():
# 获取淘宝服务器的时间戳
r1 = requests.get(url='http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp',
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36'}
练手写的python 淘宝购物车秒杀器 源码,成品链接,效果图
最新推荐文章于 2022-10-28 11:30:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)