255 lines
8.9 KiB
Plaintext
255 lines
8.9 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2025-07-23T06:51:20.992242Z",
|
|
"start_time": "2025-07-23T06:51:20.649364Z"
|
|
}
|
|
},
|
|
"cell_type": "code",
|
|
"source": [
|
|
"import requests\n",
|
|
"from module import F6_module\n",
|
|
"import time\n",
|
|
"\n",
|
|
"f6_module = F6_module()\n",
|
|
"\n",
|
|
"username = \"18742526670\"\n",
|
|
"password = \"Zy18742526670\"\n",
|
|
"store_name = \"F6智慧门店—全功能体验ES\"\n",
|
|
"org_name = '分店测试(废弃)'\n",
|
|
"\n",
|
|
"res = f6_module.login_in(username,password,store_name)\n",
|
|
"print(res.json())\n",
|
|
"cookies = requests.utils.dict_from_cookiejar(res.cookies)\n",
|
|
"print(cookies) # 登录获取cookies"
|
|
],
|
|
"id": "59524c9b52ad0c8c",
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[('f6sid', '92c57da1-57c0-47fd-8199-8254d3d8ca11')]\n",
|
|
"{'btnStatus': '', 'code': 0, 'data': None, 'idBill': None, 'idCar': None, 'idCustomer': None, 'idPay': None, 'idStock': None, 'list': None, 'message': None, 'noBill': None, 'noPay': None, 'noStock': None, 'options': {'endDate': '2026-12-31', 'intervalDays': 526, 'isDealer': False}, 'pageResult': None, 'param': '', 'result': None, 'status': 'success', 'str': '', 'token': ''}\n",
|
|
"{'f6sid': 'e6f4d4da-e830-4499-9997-022d0363ea9a', 'un': '15919462121159692302', 'prodOrg': '11240984669917188035', 'unp': '15919462121159692302', '_up': '-NillNN-qyBEJ--t3vnSknvoOF52zPiJts8E0Xo-X-5bX_PCp5vQjaZJ9Q3d-WrAAGgt60MgQHajHWBHMKKxj0CuWypi1JgKCFP1EPEk-HbqEfAWrIgm3wIN-vBRv-ZNHu3M-GTc15m4EXGqr-9UiO4Tll_BPRNtrEj93niw_czZMBk.'}\n"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 20
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"id": "initial_id",
|
|
"metadata": {
|
|
"collapsed": true,
|
|
"ExecuteTime": {
|
|
"end_time": "2025-07-23T03:41:17.111282Z",
|
|
"start_time": "2025-07-23T03:40:29.526038Z"
|
|
}
|
|
},
|
|
"source": [
|
|
"import requests\n",
|
|
"\n",
|
|
"url = \"https://yunxiu.f6car.cn/purchase/baseInfo/supplier/getSupplierList\"\n",
|
|
"params = {\n",
|
|
" \"currentPage\": 1,\n",
|
|
" \"pageSize\": 100,\n",
|
|
" \"keyword\": \"\",\n",
|
|
" \"isDel\": \"\",\n",
|
|
" \"payType\": \"\",\n",
|
|
" \"keepAccounts\": \"\",\n",
|
|
" \"mainContent\": \"\",\n",
|
|
" \"supplierCloudType\": \"\",\n",
|
|
" \"idSupplierGroup\": \"\"\n",
|
|
"}\n",
|
|
"res = requests.get(url, cookies = cookies, params = params)\n",
|
|
"\n",
|
|
"total = res.json().get(\"data\").get(\"total\")\n",
|
|
"total_pages = (total // params[\"pageSize\"]) + (1 if total % params[\"pageSize\"] > 0 else 0)\n",
|
|
"print(f\"总计{total_pages}页\")\n",
|
|
"\n",
|
|
"all_suppliers = []\n",
|
|
"max_retries =10\n",
|
|
"retry_count = 0\n",
|
|
"for page in range(1, total_pages + 1):\n",
|
|
" print(f\"正在请求第 {page} 页...\")\n",
|
|
" params[\"currentPage\"] = page\n",
|
|
" \n",
|
|
" while retry_count < max_retries:\n",
|
|
" response = requests.get(url, cookies=cookies, params=params)\n",
|
|
" time.sleep(1)\n",
|
|
" if response.status_code == 200:\n",
|
|
" break\n",
|
|
" else:\n",
|
|
" retry_count += 1\n",
|
|
" print(f\"请求第 {page} 页失败,正在重试(第 {retry_count} 次)...\")\n",
|
|
" time.sleep(3)\n",
|
|
"\n",
|
|
" try:\n",
|
|
" suppliers = response.json().get(\"data\", {}).get(\"list\", [])\n",
|
|
" all_suppliers.extend(suppliers)\n",
|
|
" except Exception as e:\n",
|
|
" print(f\"请求第 {page} 页失败,错误:\", e)\n",
|
|
" continue\n",
|
|
" \n",
|
|
"print(all_suppliers)\n"
|
|
],
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"正在请求第 1 页...\n",
|
|
"正在请求第 2 页...\n",
|
|
"正在请求第 3 页...\n",
|
|
"正在请求第 4 页...\n",
|
|
"正在请求第 5 页...\n",
|
|
"正在请求第 6 页...\n",
|
|
"正在请求第 7 页...\n",
|
|
"正在请求第 8 页...\n",
|
|
"正在请求第 9 页...\n",
|
|
"正在请求第 10 页...\n",
|
|
"正在请求第 11 页...\n",
|
|
"正在请求第 12 页...\n",
|
|
"正在请求第 13 页...\n",
|
|
"正在请求第 14 页...\n",
|
|
"正在请求第 15 页...\n",
|
|
"正在请求第 16 页...\n",
|
|
"正在请求第 17 页...\n",
|
|
"正在请求第 18 页...\n",
|
|
"正在请求第 19 页...\n",
|
|
"正在请求第 20 页...\n",
|
|
"正在请求第 21 页...\n",
|
|
"正在请求第 22 页...\n",
|
|
"正在请求第 23 页...\n",
|
|
"正在请求第 24 页...\n",
|
|
"正在请求第 25 页...\n",
|
|
"正在请求第 26 页...\n",
|
|
"正在请求第 27 页...\n",
|
|
"正在请求第 28 页...\n",
|
|
"正在请求第 29 页...\n",
|
|
"正在请求第 30 页...\n",
|
|
"正在请求第 31 页...\n",
|
|
"正在请求第 32 页...\n",
|
|
"正在请求第 33 页...\n",
|
|
"正在请求第 34 页...\n",
|
|
"正在请求第 35 页...\n",
|
|
"正在请求第 36 页...\n",
|
|
"正在请求第 37 页...\n",
|
|
"正在请求第 38 页...\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"IOPub data rate exceeded.\n",
|
|
"The Jupyter server will temporarily stop sending output\n",
|
|
"to the client in order to avoid crashing it.\n",
|
|
"To change this limit, set the config variable\n",
|
|
"`--ServerApp.iopub_data_rate_limit`.\n",
|
|
"\n",
|
|
"Current values:\n",
|
|
"ServerApp.iopub_data_rate_limit=1000000.0 (bytes/sec)\n",
|
|
"ServerApp.rate_limit_window=3.0 (secs)\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 17
|
|
},
|
|
{
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2025-07-23T06:55:02.540855Z",
|
|
"start_time": "2025-07-23T06:55:02.307642Z"
|
|
}
|
|
},
|
|
"cell_type": "code",
|
|
"source": [
|
|
"import requests\n",
|
|
"\n",
|
|
"\n",
|
|
"json_data = {\"pkId\":\"12078664162960486435\"}\n",
|
|
"\n",
|
|
"response = requests.get(\n",
|
|
" 'https://yunxiu.f6car.cn/purchase/baseInfo/supplier/getSupplierInfo',\n",
|
|
" cookies=cookies,\n",
|
|
" params=json_data,\n",
|
|
")\n",
|
|
"\n",
|
|
"supplier_info = response.json().get(\"data\").get(\"supplierInfo\")\n",
|
|
"print(supplier_info)\n"
|
|
],
|
|
"id": "b0b94bd37739a1c3",
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"{'address': '', 'area': '', 'city': '', 'contactMobile': '', 'contactTelephone': '', 'contacts': '', 'creationtime': 1753238686000, 'creator': '15969525162714341434', 'creatorName': '重庆-张立', 'detailAddress': '', 'email': '', 'fax': '', 'idFrom': 0, 'idOrgSource': 0, 'idOwnOrg': '11240984669917188035', 'idSupplierGroup': '0', 'invoiceOpenBank': '', 'invoiceOpenNumber': '', 'invoiceOrgName': '', 'invoiceOrgTax': '', 'invoiceRegisterAddr': '', 'invoiceRegisterPhone': '', 'invoiceType': '0', 'isCarzone': 0, 'isDel': 0, 'isMatchedAllOrg': 0, 'keepAccounts': 0, 'latitude': '', 'longitude': '', 'mainContent': '', 'mnemonic': 'ztqp,zhengtaoqipei', 'modifiedtime': 1753252594000, 'modifier': '15919462121159692302', 'modifyName': '张阳', 'name': '郑涛汽配', 'otherContacts': '', 'payType': '0', 'pkId': '12078664162960486435', 'province': '', 'qq': '', 'relateOrgId': '0', 'serviceUnit': 0, 'street': '', 'supplierAbbreviation': '', 'supplierDepartmentId': '', 'supplierGroupName': '', 'supplierOrgId': 0, 'supplierType': 1, 'taxRate': 0.0}\n"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 28
|
|
},
|
|
{
|
|
"metadata": {
|
|
"ExecuteTime": {
|
|
"end_time": "2025-07-23T06:58:45.361442Z",
|
|
"start_time": "2025-07-23T06:58:45.356601Z"
|
|
}
|
|
},
|
|
"cell_type": "code",
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"up_dict = [\n",
|
|
" {\"供应商名称\": \"郑涛汽配\", \"操作\": \"停用\", \"修改适用门店\": \"全部门店\"},\n",
|
|
" {\"供应商名称\": \"奥马汽配\", \"操作\": \"启用\", \"修改适用门店\": \"全功能体验\"},\n",
|
|
" {\"供应商名称\": \"陕西畅圭商贸\", \"操作\": \"启用\", \"修改适用门店\": \"全功能别克品牌2店;全功能体验\"},\n",
|
|
"]\n",
|
|
"\n",
|
|
"df = pd.DataFrame(up_dict)\n",
|
|
"for index, row in df.iterrows():\n",
|
|
" print(row[\"供应商名称\"])\n"
|
|
],
|
|
"id": "edb98dd818e65586",
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"郑涛汽配\n",
|
|
"奥马汽配\n",
|
|
"陕西畅圭商贸\n"
|
|
]
|
|
}
|
|
],
|
|
"execution_count": 34
|
|
}
|
|
],
|
|
"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
|
|
}
|