{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import json\n", "import json\n", "import xlrd\n", "import xlwt\n", "import pandas as pd\n", "\n", "headers = {\n", " 'Accept': 'application/json, text/javascript, */*; q=0.01',\n", " 'Accept-Encoding': 'gzip, deflate',\n", " 'Accept-Language': 'zh-CN,zh;q=0.9',\n", " 'Connection': 'keep-alive',\n", " 'Content-Length': '81',\n", " 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n", " 'Cookie': 'JSESSIONID=3747D6BC539881407DCB2159B4141C73',\n", " 'Host': 'www.idsz.xin:7070',\n", " 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n", " 'Referer':'http://www.idsz.xin:7070/Sale_Order',\n", " 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',\n", " 'X-Requested-With': 'XMLHttpRequest'\n", "}\n", "\n", "data = xlrd.open_workbook(r\"C:\\Users\\admin\\Desktop\\新建XLS 工作表 (5).xls\")\n", "table = data.sheet_by_index(0)\n", "\n", "h = table.nrows\n", "\n", "l = table.ncols\n", "\n", "for i in range(1,h):\n", " car_no =table.cell(i, 0).value\n", "\n", " data = {\n", " \"car_no\": car_no \n", " }\n", " # print(data)\n", " url1='http://www.idsz.xin:7070/posapi_invoke?apiname=sale_opensale_bbillsearchcar_new&queryStr='+car_no+'&index=2&type=-1&begin=2001-01-01&end=2022-05-23'\n", "\n", " response = requests.get(url=url1,data=data,headers=headers)\n", " try:\n", " res = response.json()\n", " re=res[\"userObject\"][0][\"uuid\"]\n", " print(car_no,re)\n", " except:\n", " print(car_no,\"无查询数据\")\n", " " ] } ], "metadata": { "kernelspec": { "display_name": "F6processing", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.4" } }, "nbformat": 4, "nbformat_minor": 2 }