- Add agent configuration files (AGENTS.md, USER.md, IDENTITY.md, SOUL.md) - Add git configuration and skills management scripts - Add frontend/backend analysis tools and reports - Add DingTalk media sender utilities and documentation - Fix OpenClaw runtime environment (Node.js and Python) - Configure git remotes and push scripts
57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
import requests
|
|
import json
|
|
import os
|
|
|
|
# from previous message in openclaw.json
|
|
DINGTALK_APP_KEY = "ding4ursdp0l2giat4bj"
|
|
DINGTALK_APP_SECRET = "J0gBicjKiIHoKla7WfKKhRs1Tv8L6Xd5UhW3EVQByF16G7Vn7UUcRhP6u-PBCQNo"
|
|
ROBOT_CODE = "ding4ursdp0l2giat4bj"
|
|
OPEN_CONVERSATION_ID = "cidcjYshXVtKck5LfOO9AqOJg=="
|
|
|
|
FILE_PATH = r"C:\Users\ALC\.openclaw\workspace\前后端功能与开源可修改性分析报告.docx"
|
|
|
|
def test_api_access_token():
|
|
"""测试不同的token端点"""
|
|
urls = [
|
|
"https://api.dingtalk.com/v1.0/oauth2/getAccessToken",
|
|
"https://api.dingtalk.com/v1.0/oauth2/accessToken",
|
|
"https://oapi.dingtalk.com/gettoken",
|
|
]
|
|
|
|
headers = {"Content-Type": "application/json"}
|
|
data = {"appKey": DINGTALK_APP_KEY, "appSecret": DINGTALK_APP_SECRET}
|
|
|
|
for url in urls:
|
|
try:
|
|
print(f"Testing: {url}")
|
|
r = requests.post(url, headers=headers, json=data, timeout=10)
|
|
print(f"Status: {r.status_code}")
|
|
print(f"Response: {r.text[:200]}")
|
|
if r.status_code == 200:
|
|
result = r.json()
|
|
if "accessToken" in result:
|
|
return result["accessToken"]
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
print("")
|
|
|
|
return None
|
|
|
|
def main():
|
|
try:
|
|
print("=== Testing DingTalk Token Endpoints ===")
|
|
|
|
token = test_api_access_token()
|
|
if token:
|
|
print(f"\nSuccess! Token obtained: {token[:20]}...")
|
|
else:
|
|
print("\nAll token endpoints failed")
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|