首页 > 编程语言 >python 定时认证

python 定时认证

时间:2022-11-15 09:12:02浏览次数:38  
标签:8081 application python image 0.2 认证 ## 10.255 定时

import requests,time,sys,re,json,schedule
from datetime import date,datetime
aa1='''Host: 10.255.0.2:8081
Content-Length: 83
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://10.255.0.2:8081
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://10.255.0.2:8081/?userip=172.16.128.15&usermac=c0b8e6f8b77a&info=
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: isRemember=true; username=%u9648%u4E14%u6D77; password=19660211
Connection: keep-alive'''
def headxx(aab):
    abx=[]
    ax1=aab.split('\n')
    for i in ax1:
        ax2=i.split(': ')
        abx.append((ax2[0],ax2[1]))
    tt=dict(abx)
    return tt
def denglu():
    print("the time:%s"% datetime.now())
    url="http://10.255.0.2:8081/login.html"
##    aa1='''Host: 10.255.0.2:8081
##    Content-Length: 83
##    Cache-Control: max-age=0
##    Upgrade-Insecure-Requests: 1
##    Origin: http://10.255.0.2:8081
##    Content-Type: application/x-www-form-urlencoded
##    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
##    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
##    Referer: http://10.255.0.2:8081/?userip=172.16.128.15&usermac=c0b8e6f8b77a&info=
##    Accept-Encoding: gzip, deflate
##    Accept-Language: zh-CN,zh;q=0.9
##    Cookie: isRemember=true; username=%u9648%u4E14%u6D77; password=19660211
##    Connection: keep-alive'''
    data1="signname=Red-Giant&username=%B3%C2%C7%D2%BA%A3&password=19660211&signname=Red-Giant"

    head1=headxx(aa1)
    aa=requests.post(url,headers=head1,data=data1)
schedule.every().day.at("04:01").do(denglu,)
schedule.every().day.at("04:05").do(denglu,)
print("the time:%s"% datetime.now())
#denglu()
while 1:
    schedule.run_pending()

 

标签:8081,application,python,image,0.2,认证,##,10.255,定时
From: https://www.cnblogs.com/xkdn/p/16891290.html

相关文章

  • 10-1 k8s认证及serviceacount
    k8s有2类认证时的账号:1useraccount:也称为用户账号2serviceaccount:也称为服务账号,访问k8s集群apiserver时用到的认证信息,包括用户名,账号,密码....serviceaccount:......
  • 新的学习历程-python6 字符串基础使用
    1sentence1='tom\'spetisacat'#单引号中包含转单引号2sentence2="tom\'spetisacat"3sentence3="tomsaid:\"helloworld\""4sentence4='to......
  • python比较与身份运算符
    比较运算符==   a==b!=   a!=b>    a>b<    a<b>=   a>=b<=   a<=b<>   判断是否不等于 a<>b  在pyt......
  • 【Linux环境部署】Python版本更新及替换
    默认python版本替换1.测试当前默认python版本user@user-jwq#pythonPython2.7.18(default,Jul12022,12:27:04)[GCC9.4.0]onlinux2Type"help","copyright......
  • python中的if条件分支
    1.if基础语法#条件判断分支语句#if#关键词如果假设#如果明天下雨,我就去图书馆看书"""if条件语句:满足条件运行的代码1满足条件运行的代码2"""......
  • python的bug
    python的异常处理机制:                 这些异常可能会存储在文件里pycharm开发环境的调试: ......
  • 拓端tecdat|用Prophet在Python编程代写中进行时间序列预测
     预测通常被认为是报告的自然发展。报告可以帮助我们回答,发生了什么事?预测有助于回答下一个逻辑问题,将会发生什么?Prophet的目的是“使专家和非专家可以更轻松地进行符合需......
  • 拓端tecdat|python编程代写对NOAA天气数据格式转换
    转换NOAA天气数据文件“.fly”为PandasDataFrame 获取数据ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/dailyIn[1]:importmatplotlib.pyplotaspltimportpandas......
  • 【python 时间】python处理时间
    当前时间#coding=utf-8importtimeimportdatetimelocaltime=time.localtime(time.time())print(localtime)#格式化时间now=datetime.datetime.now()print......
  • Python函数
    1.函数的定义1.函数代码用关键字def声明,后接函数标志性名称(参数)2.函数参数放置()中,可以有零个或多个3.return表达式结束函数4.匿名函数:lambda......