断续重连报错在评论区

import re
import requests
from time import strftime
import time

# URL地址
schoolWebURL = 'http://10.10.43.3'  # 或者是'http://10.10.43.3'

while(True):
    response = requests.get(schoolWebURL)

    # 正则表达式,匹配<title>标签中的内容
    pattern = re.compile('<title>(.*?)</title>', re.S)
    title = re.findall(pattern, response.text)
    title = title[0]  # 将格式转为字符串

    if title == '注销页':
        print('%s %s 连接正常' % (strftime('%Y-%m-%d'),strftime('%H:%M:%S')))
        time.sleep(60)
        pass
    
    else:
        user = ''  # 学号
        p = ''  # 密码
        t = str(int(round(time.time() * 10000)))  # 毫秒级时间戳
        schoolWebLoginURL = schoolWebURL+'/drcom/login?callback=dr'+t+'&DDDDD='+user+'&upass='+p+'&0MKKey=123456&R1=0&R3=0&R6=0&para=00&v6ip=&_='+t
        print('%s %s 登录成功' % (strftime('%Y-%m-%d'),strftime('%H:%M:%S')))
        requests.get(schoolWebLoginURL)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值