首页 > 其他分享 >某钉自动打卡示例(仅供学习,不喜勿喷)

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

时间:2023-03-15 09:34:52浏览次数:43  
标签:示例 json access token user 不喜 打卡 id

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("打卡失败")

 

标签:示例,json,access,token,user,不喜,打卡,id
From: https://www.cnblogs.com/vip136510786/p/17217307.html

相关文章