某钉自动打卡示例(仅供学习,不喜勿喷)

import requests
import json

# 钉钉API地址和access_token,根据实际情况修改
url = "https://oapi.dingtalk.com/attendance/v1/advanced/record/create"
access_token = "your_access_token"

# 待打卡的用户ID和打卡类型,根据实际情况修改
user_id = "your_user_id"
record_type = "外勤打卡"

# 构造请求参数
data = {
    "user_id": user_id,
    "biz_type": record_type,
    "biz_id": "biz_id",
    "time": "2022-03-15 09:00:00",
    "location_title": "深圳市南山区",
    "location_detail": "深圳市南山区科技园南区",
    "remark": "备注",
    "source": "pc",
    "photo_url_list": ["https://example.com/photo.jpg"],
}

# 发送请求
headers = {"Content-Type": "application/json"}
params = {"access_token": access_token}
response = requests.post(url, headers=headers, params=params, data=json.dumps(data))

# 解析响应
result = json.loads(response.text)
if result["errcode"] == 0:
    print("打卡成功")
else:
    print("打卡失败")

 

posted @ 2023-03-15 09:26  trysocket  阅读(122)  评论(0编辑  收藏  举报