吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 611|回复: 1
收起左侧

[讨论] 某钉C端创建日报请求数据无法抓取

[复制链接]
Flanders 发表于 2023-6-2 11:55
思路
想通过api来写某钉的日报,pc版h5加载出奇的慢\效率太低,于是用Fiddler尝试获取日报创建请求数据。


结果
遇到的问题:某钉pc客户端创建日志api数据无法通过Fiddler抓取?
微信截图_20230602113255.png


整理了部分api创建日报的python代码,和大家讨论讨论发散思路 ^_^

import requests
import datetime
import json

# 钉钉开放平台提供的 API 接口地址
get_user_info_url = 'https://oapi.dingtalk.com/getuserinfo'
send_work_notice_url = 'https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2'
add_daily_report_url = 'https://oapi.dingtalk.com/topapi/report/add'

# 需要填充的参数信息
app_key = 'your_app_key'  # 应用Key值
app_secret = 'your_app_secret'  # 应用秘钥
agent_id = 'your_agent_id'  # 应用ID
touser = 'your_account_id'  # 日报接收人的 ID
date = datetime.date.today()  # 日报日期
title = '工作日报'  # 日报标题
content = '今日工作内容:\n\n1. \n\n2. \n\n3. \n\n\n明日工作计划:\n\n1. \n\n2. \n\n3. \n\n\n存在的问题:\n\n1. \n\n2. \n\n3. \n\n'  # 日报内容

# 获取当前用户的ID
def get_user_id():
    params = {'access_token': access_token}
    response = requests.get(get_user_info_url, params=params)
    user_info = json.loads(response.text)
    return user_info['userid']

# 发送工作通知
def send_notice(access_token, agent_id, touser, content):
    params = {'access_token': access_token}
    data = {
        'agent_id': agent_id,
        'msg': {
            'msgtype': 'text',
            'text': {
                'content': content
            },
            'touser': touser
        },
        'to_all_user': False,
        'userid_list': []
    }
    response = requests.post(send_work_notice_url, params=params, json=data)
    print('工作通知发送结果:', response.json())

# 添加日报
def add_daily_report(access_token, userid, template_name, date, title, content):
    headers = {'Content-Type': 'application/json'}
    params = {'access_token': access_token}
    data = {
        'template_name': template_name,
        'dept_id': '',
        'userid': userid,
        'date': date.isoformat(),
        'contents': [
            {
                'title': title,
                'key1': '',
                'value1': content,
                'key2': '',
                'value2': ''
            }
        ]
    }
    response = requests.post(add_daily_report_url, headers=headers, params=params, json=data)
    print('日报提交结果:', response.json())

# 获取 Access Token
def get_access_token():
    params = {
        'appkey': app_key,
        'appsecret': app_secret
    }
    response = requests.get('https://oapi.dingtalk.com/gettoken', params=params)
    return response.json()['access_token']

if __name__ == '__main__':
    # 设置参数值
    access_token = get_access_token()
    userid = get_user_id()

    # 发送工作通知
    notice_content = '今天的工作日报已经自动提交,请查看钉钉工作通知。时间:{}'.format(datetime.datetime.now().strftime('%H:%M:%S'))
    send_notice(access_token, agent_id, touser, notice_content)

    # 提交日报
    add_daily_report(access_token, userid, '模板名称', date, title, content)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

云烟成雨 发表于 2023-6-2 16:52
钉钉我一开代{过}{滤}理他瞄的就闪退了,别说抓包了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-13 07:49

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表