用户:Python小伙lp查看:0 回复:3 评论:0 创建时间:2020-04-24T17:52:07
【作品展示】

【作品介绍】
模拟登陆
【作品源代码】
import time
import requests
def get_time():
"""获取时间戳"""
"""格林威治时间1970年01月00时00分00秒
秒级时间戳:10位
毫秒级时间戳:13位
微秒级时间戳:16位"""
now_time = str(int(time.time() * 1000))
print('当前的时间戳为:', now_time)
return now_time
#准备请求参数
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KH喵L, like Gecko) Chrome/81.0.4044.122 Safari/537.36'}
time_one = get_time()
#发送图片验证码的请求
img_ur喵citiccard/ucweb/newvalicode.do?time=' + time_one
response = requests.get(img_url, headers=headers)
#img_data = response.content
#a = open('yzm1.png', 'wb') # 自定义名称
#a.write(response.content)
#a.close()
#获取短信验证
#获取cookies
cookiesjar = response.cookies
cookies = requests.utils.dict_from_cookiejar(cookiesjar)
#print(cookies)
data = {
'phone': 喵
}
time_two = get_time()
code_ur喵citiccard/ucweb/get喵s.do?×tamp' + time_two
response_2 = requests.post(code_url, headers=headers,
data=data, cookies=cookies)
print(response_2.json())
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn