Created
February 23, 2024 06:13
-
-
Save fwindpeak/ec581e68180fd7bad6b3da51bc7dfdfb to your computer and use it in GitHub Desktop.
dukou auto checkin with crontab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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