admin管理员组

文章数量:1130349

获取接龙管家token

  • 前言
  • 条件
  • 代码
  • 碎碎念

前言

之前写了接龙管家的python打卡,但是它的token有效期只有三四天,所以需要经常更换

最后采取的方法是:

  1. Selenium 模拟登录网页版接龙管家
  2. 获取登录小程序码用邮件发送到手机
  3. 扫码登录
  4. 将token存储在本地
  5. 读取token运行打卡脚本

条件

需要的条件是有云服务器(或者本地不关机运行也行)、然后安装配置python、requests、selenium、chrome、chromedriver等

代码

最后附上代码:

from selenium import webdriver#核心
import requests#核心
import time#用来显示打卡日期
import yagmail#用来发送登录码、打卡信息,不用也可以
import os#用来在脚本里运行另一个脚本
import json#打卡脚本里用的,这里好像没用

print(time.strftime("========= %Y年%m月%d日 =========== refresh",time.gmtime()))

option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('no-sandbox')
option.add_argument('disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_options=option)

driver.get('https://jielong.co/')
print(driver.title)

#设置位置之后的所有元素定位操作都有最大等待时间十秒,在10秒内会定期进行元素定位,超过设置时间之后将会报错
driver.implicitly_wait(10)

#__RequestVerificationToken
RequestVerificationToken = driver.find_element_by_name('__RequestVerificationToken').get_attribute('value')
print('RequestVerificationToken: ',RequestVerificationToken)

获取接龙管家token

  • 前言
  • 条件
  • 代码
  • 碎碎念

前言

之前写了接龙管家的python打卡,但是它的token有效期只有三四天,所以需要经常更换

最后采取的方法是:

  1. Selenium 模拟登录网页版接龙管家
  2. 获取登录小程序码用邮件发送到手机
  3. 扫码登录
  4. 将token存储在本地
  5. 读取token运行打卡脚本

条件

需要的条件是有云服务器(或者本地不关机运行也行)、然后安装配置python、requests、selenium、chrome、chromedriver等

代码

最后附上代码:

from selenium import webdriver#核心
import requests#核心
import time#用来显示打卡日期
import yagmail#用来发送登录码、打卡信息,不用也可以
import os#用来在脚本里运行另一个脚本
import json#打卡脚本里用的,这里好像没用

print(time.strftime("========= %Y年%m月%d日 =========== refresh",time.gmtime()))

option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('no-sandbox')
option.add_argument('disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_options=option)

driver.get('https://jielong.co/')
print(driver.title)

#设置位置之后的所有元素定位操作都有最大等待时间十秒,在10秒内会定期进行元素定位,超过设置时间之后将会报错
driver.implicitly_wait(10)

#__RequestVerificationToken
RequestVerificationToken = driver.find_element_by_name('__RequestVerificationToken').get_attribute('value')
print('RequestVerificationToken: ',RequestVerificationToken)

本文标签: 接龙管家tokenpython