Skip to content

Instantly share code, notes, and snippets.

@fwindpeak
Created February 23, 2024 06:13
Show Gist options
  • Select an option

  • Save fwindpeak/ec581e68180fd7bad6b3da51bc7dfdfb to your computer and use it in GitHub Desktop.

Select an option

Save fwindpeak/ec581e68180fd7bad6b3da51bc7dfdfb to your computer and use it in GitHub Desktop.
dukou auto checkin with crontab
#!/bin/env python3
#coding:utf-8
import requests
import json
from datetime import datetime
email="email"
passwd="passwd"
token = requests.post('https://dukou.io/api/token',json={"email":email,"passwd":passwd}).json()['token']
url = "https://dukou.icu/api/user/checkin"
headers = {"Access-Token":token}
r = requests.get(url,headers=headers).json()
print(r)
result = r['result']
now = datetime.now()
dt_string = now.strftime("%Y-%m-%d %H:%M:%S")
line = dt_string+" "+result+"\n"
open("./dukou.log","a").write(line)
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment