Files
F6--/CCPaaS.ipynb
2026-01-30 11:28:35 +08:00

233 lines
8.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# 权鉴请求",
"id": "531f1a2429f3444a"
},
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-08-04T06:16:16.333259Z",
"start_time": "2025-08-04T06:16:16.069427Z"
}
},
"source": [
"import requests\n",
"import time\n",
"import hashlib\n",
"\n",
"# 参数\n",
"app_id = \"ac331f73-8071-4caa-7b06-84d2f5371a52\"\n",
"sid = \"123456789abcdef\"\n",
"secret = \"secret-b78b4e07-9310-44ff-749c-367240b5a0f5\" # 这相当于 secret\n",
"\n",
"# 当前时间戳(秒级)\n",
"ts = str(int(time.time()))\n",
"\n",
"# 生成 signSHA-1(salt + secret + ts)\n",
"sign_str = sid + secret + ts\n",
"sign = hashlib.sha1(sign_str.encode('utf-8')).hexdigest()\n",
"\n",
"# 构造 URL\n",
"url = f\"https://f6car.udesk.cn/ccapi/v2/spnumbers?AppId={app_id}&Timestamp={ts}&Sid={sid}&Sign={sign}\"\n",
"\n",
"# 发起请求\n",
"res = requests.get(url)\n",
"print(\"Response:\", res.text)\n",
"print(\"Timestamp:\", ts)\n",
"print(\"Sign String (raw):\", sign_str)\n",
"print(\"Sign (SHA-1):\", sign)"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response: <!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
" <meta charset=\"UTF-8\">\n",
" <title>ERROR 404</title>\n",
" <meta name=\"baidu-site-verification\" content=\"bfnCTh0lxs\" />\n",
" <style>\n",
" html,body{height: 100%;margin: 0;padding: 0;min-width: 1024px;font-family: \"Microsoft Yahei\",Tahoma,Arial,STHeiti,sans-serif,\"宋体\";}\n",
" .error{position: absolute;top: 50%;left: 50%;width: 1000px;margin-left: -500px;}\n",
" body.error-404{min-height: 400px;}\n",
" body.error-404 .error{height: 262px;margin-top: -180px;background: url('/assets/error/error-404-bg.png') no-repeat;}\n",
" .btn{position: absolute;top: 0;left: 0;width: 130px;height: 46px;color: #fff;font-size: 18px;line-height: 46px;background: #2ea1ca;border-radius: 3px;text-align: center;text-decoration: none;box-shadow: 1px 1px 2px #41899e;}\n",
" a:hover{text-decoration: underline;}\n",
" .btn1{position: absolute;top: 0;left: 0;width: 130px;height: 46px;color: #fff;font-size: 18px;line-height: 46px;background: #7fb602;border-radius: 3px;text-align: center;text-decoration: none;}\n",
" </style>\n",
"</head>\n",
"<body class=\"error-404\">\n",
" <div class=\"error\">\n",
" <p style=\"position: absolute;top: 228px;left: 70px;font-size: 18px;color: #002934;\">请下达指示:</p>\n",
" <a class=\"btn\" style=\"top: 300px;left: 70px;\" href=\"/\">返回控制台</a>\n",
" </div>\n",
" <!-- ga -->\n",
" <script type=\"text/javascript\">\n",
" (function(i, s, o, g, r, a, m) {\n",
" i['GoogleAnalyticsObject'] = r;\n",
" i[r] = i[r] || function() {\n",
" (i[r].q = i[r].q || []).push(arguments)\n",
" }, i[r].l = 1 * new Date();\n",
" a = s.createElement(o),\n",
" m = s.getElementsByTagName(o)[0];\n",
" a.async = 1;\n",
" a.src = g;\n",
" m.parentNode.insertBefore(a, m)\n",
" })(window, document, 'script', '/assets/google/analytics.js', 'ga');\n",
" (function(ga) {\n",
" var r = new RegExp(\"[\\\\?&]client_uuid=([^&#]*)\"),\n",
" p = r.exec(location.search);\n",
" if (p === null) {\n",
" ci = undefined;\n",
" } else {\n",
" ci = decodeURIComponent(p[1].replace(/\\+/g, \" \"));\n",
" }\n",
" ga('create', 'UA-69864074-1', {\n",
" 'clientId': ci\n",
" });\n",
" ga('send', 'pageview');\n",
" })(ga);\n",
" </script>\n",
"</body>\n",
"</html>\n",
"\n",
"Timestamp: 1754288176\n",
"Sign String (raw): 123456789abcdefsecret-b78b4e07-9310-44ff-749c-367240b5a0f51754288176\n",
"Sign (SHA-1): 41c3bf8f1e77436f19d238e9842359db0bfdeacb\n"
]
}
],
"execution_count": 14
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-08-04T06:01:03.742483Z",
"start_time": "2025-08-04T06:01:03.452284Z"
}
},
"cell_type": "code",
"source": [
"import requests\n",
"import time\n",
"import hashlib\n",
"\n",
"# 参数\n",
"app_id = \"ac331f73-8071-4caa-7b06-84d2f5371a52\"\n",
"sid = \"123456789abcdef\"\n",
"secret = \"secret-b78b4e07-9310-44ff-749c-367240b5a0f5\" # 这相当于 secret\n",
"\n",
"# 当前时间戳(秒级)\n",
"ts = str(int(time.time()))\n",
"\n",
"# 生成 signSHA-1(salt + secret + ts)\n",
"sign_str = sid + secret + ts\n",
"sign = hashlib.sha1(sign_str.encode('utf-8')).hexdigest()\n",
"\n",
"# 构造 URL\n",
"url = f\"https://f6car.udesk.cn/ccapi/v2/agents?AppId={app_id}&Timestamp={ts}&Sid={sid}&Sign={sign}\"\n",
"\n",
"# 发起请求\n",
"res = requests.get(url)\n",
"print(\"Response:\", res.text)\n",
"print(\"Timestamp:\", ts)\n",
"print(\"Sign String (raw):\", sign_str)\n",
"print(\"Sign (SHA-1):\", sign)"
],
"id": "f78184bf27c5ef49",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response: <!DOCTYPE html>\n",
"<html lang=\"en\">\n",
"<head>\n",
" <meta charset=\"UTF-8\">\n",
" <title>ERROR 404</title>\n",
" <meta name=\"baidu-site-verification\" content=\"bfnCTh0lxs\" />\n",
" <style>\n",
" html,body{height: 100%;margin: 0;padding: 0;min-width: 1024px;font-family: \"Microsoft Yahei\",Tahoma,Arial,STHeiti,sans-serif,\"宋体\";}\n",
" .error{position: absolute;top: 50%;left: 50%;width: 1000px;margin-left: -500px;}\n",
" body.error-404{min-height: 400px;}\n",
" body.error-404 .error{height: 262px;margin-top: -180px;background: url('/assets/error/error-404-bg.png') no-repeat;}\n",
" .btn{position: absolute;top: 0;left: 0;width: 130px;height: 46px;color: #fff;font-size: 18px;line-height: 46px;background: #2ea1ca;border-radius: 3px;text-align: center;text-decoration: none;box-shadow: 1px 1px 2px #41899e;}\n",
" a:hover{text-decoration: underline;}\n",
" .btn1{position: absolute;top: 0;left: 0;width: 130px;height: 46px;color: #fff;font-size: 18px;line-height: 46px;background: #7fb602;border-radius: 3px;text-align: center;text-decoration: none;}\n",
" </style>\n",
"</head>\n",
"<body class=\"error-404\">\n",
" <div class=\"error\">\n",
" <p style=\"position: absolute;top: 228px;left: 70px;font-size: 18px;color: #002934;\">请下达指示:</p>\n",
" <a class=\"btn\" style=\"top: 300px;left: 70px;\" href=\"/\">返回控制台</a>\n",
" </div>\n",
" <!-- ga -->\n",
" <script type=\"text/javascript\">\n",
" (function(i, s, o, g, r, a, m) {\n",
" i['GoogleAnalyticsObject'] = r;\n",
" i[r] = i[r] || function() {\n",
" (i[r].q = i[r].q || []).push(arguments)\n",
" }, i[r].l = 1 * new Date();\n",
" a = s.createElement(o),\n",
" m = s.getElementsByTagName(o)[0];\n",
" a.async = 1;\n",
" a.src = g;\n",
" m.parentNode.insertBefore(a, m)\n",
" })(window, document, 'script', '/assets/google/analytics.js', 'ga');\n",
" (function(ga) {\n",
" var r = new RegExp(\"[\\\\?&]client_uuid=([^&#]*)\"),\n",
" p = r.exec(location.search);\n",
" if (p === null) {\n",
" ci = undefined;\n",
" } else {\n",
" ci = decodeURIComponent(p[1].replace(/\\+/g, \" \"));\n",
" }\n",
" ga('create', 'UA-69864074-1', {\n",
" 'clientId': ci\n",
" });\n",
" ga('send', 'pageview');\n",
" })(ga);\n",
" </script>\n",
"</body>\n",
"</html>\n",
"\n",
"Timestamp: 1754287263\n",
"Sign String (raw): 123456789abcdefsecret-b78b4e07-9310-44ff-749c-367240b5a0f51754287263\n",
"Sign (SHA-1): dcc90771f98740f723956a94d43bc9821894a677\n"
]
}
],
"execution_count": 11
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}