查看json数据更新情况
#! python3
# -*- coding:utf8 -*-
#主要为读取excel中接口地址,打开网页爬取url页面中数据,解析json,检查是否符合逻辑(正常)
import requests,json,openpyxl,time
from pprint import pprint
wb=openpyxl.load_workbook('C:\\Users\\li.wu\\Desktop\\盈利宝更新情况.xlsx')
sheet=wb.get_sheet_by_name('接口更新查看')
datas=[[] for i in range(30)]
n=0
print('****** --------- 开始读取Excel数据: ------- ! **** ' )
for rowNm in sheet['A10':'D38']:
if rowNm[0].value ==None:
break
for j in rowNm:
datas[n].append(j.value)
print((n+1),' ',datas[n][1])
n+=1
print('\n---------',n," 为已读取数据行数。 excel数据读取完毕,读取网络数据结果展示开始 !------------ \n")
print('接口类型','接口名 ','查看字段','字段值')
for i in range(n):
if datas[i][3] != None :
#print(datas[i][3])
try:
hml=requests.get(datas[i][3])
except :
print(datas[i][3],'这是捕获的抛出错误')
raise
time.sleep(1)
if hml.status_code == requests.codes.ok :
#tx=json.loads(hml.text)
tx=hml.json()
if len(tx)==0:
print((i+1),datas[i][0],datas[i][3]," \n-----此链接数据为空& this url's data is None !!! ----------此链接数据为空---------!")
elif isinstance(tx,dict):
if datas[i][2]==None:
print('%s * %s : %s ' % ((i+1),datas[i][0],datas[i][1]))
pprint(tx['rows'][0])
else:
print((i+1),datas[i][0],datas[i][1],datas[i][2],tx['rows'][0][datas[i][2].strip()],'\n')
else:
if datas[i][2]==None:
print('%s * %s : %s ' % ((i+1),datas[i][0],datas[i][1]))
pprint(tx[0])
else:
print( (i+1),datas[i][0],datas[i][1],datas[i][2],tx[0][datas[i][2].strip()],'\n')
else :
print((i+1),datas[i][0],datas[i][1],datas[i][3]," \n-----此链接响应失败& this url's FALL !!! ----------此链接响应失败---------!")
查看json数据更新情况的更多相关文章
- 26. linux查看端口占用情况
linux系统下,查看端口占用情况的命令:lsof -i[root@www ~]# lsof -i
- Centos 7.0查看硬盘使用情况 命令
查看硬盘使用情况 df -hl [root@localhost ~]# df -hl文件系统 容量 已用 可用 已用%. 挂载点/dev/sda3 ...
- free命令查看内存使用情况(转载)
linux free命令查看内存使用情况 时间:2016-01-05 06:47:22来源:网络 导读:linux free命令查看内存使用情况,free命令输出结果的各选项的含义,以及free结果中 ...
- RC-50221 问题解决 - netstat 查看端口占用情况
查看端口占用情况 netstat -an|grep LIST|grep 15 数据库监听占用情况. netstat -an|grep 1521 1521为 ...
- ubuntu查看内存占用和查看cpu使用情况的简单方法(ubuntu内存管理)
单独查看内存使用情况的命令:free -m查看内存及cpu使用情况的命令:top也可以安装htop工具,这样更直观,安装命令如下:sudo apt-get install htop安装完后,直接输入命 ...
- MSSQL优化之——查看语句执行情况
MSSQL优化之——查看语句执行情况 在写SQL语句时,必须知道语句的执行情况才能对此作出优化.了解SQL语句的执行情况是每个写程序的人必不可少缺的能力.下面是对查询语句执行情况的方法介绍. 一.设置 ...
- linux查看磁盘使用情况
# 查看磁盘使用情况 $ df -l # 查看某个目录在哪个分区,比如查看/root文件夹在哪个分区 $ df /root # 查看linux系统具体分区情况 $ fdisk -l
- Mac查看端口占用情况
Mac下使用lsof(list open files)来查看端口占用情况,lsof 是一个列出当前系统打开文件的工具. 使用 lsof 会列举所有占用的端口列表: $ lsof 使用less可以用于分 ...
- Centos查看端口占用情况和开启端口命令
Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例)方法一: /sbin/i ...
随机推荐
- Spring Boot入门第一天:Hello, Spring Boot!
原文链接 1. 新建一个Maven Web项目. 2. 配置pom.xml文件. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ...
- Http Requests for PHP
一.Requests for PHP 官网:http://requests.ryanmccue.info官方介绍:Requests is a humble HTTP request library. ...
- Webpack实现路由懒加载的三种方式
原文指路:https://blog.csdn.net/qq_37540004/article/details/78727063 第一种: 引入方式(正常引入): const router = new ...
- 【洛谷p1932】A+B A-B A*B A/B A%B Problem
(emmmm) 这道题成功让我见识到了Dev撤回的高端大气上档(dàng)次. A+B A-B A*B A/B A%B Problem[传送门](真是个优秀的高精) 算法:::::::(模板题弄这么费 ...
- [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
待解决 [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. ...
- Web测试——功能测试
由于本人工作接触Web测试,所以我从网上找的资料,学习了解web测试哪些内容,然后自己整理汇总的随笔,如文章中有不足的地方,请大家多多指教:或者文章内容与他人相似,望见谅. 功能测试: 1.链接测试: ...
- 『PyTorch』第二弹_张量
参考:http://www.jianshu.com/p/5ae644748f21# 几个数学概念: 标量(Scalar)是只有大小,没有方向的量,如1,2,3等 向量(Vector)是有大小和方向的量 ...
- HTML(简介及常用标签)
一.HTML简介 1.1 html是什么? 超文本标记语言(Hypertext Markup Language,HTML)通过标签语言来标记要显示的网页中的各个部分.一套规则,浏览器认识的规则. 浏览 ...
- vue嵌套路由--params传递参数
在嵌套路由中,父路由向子路由传值除了query外,还有params,params传值有两种情况,一种是值在url中显示,另一种是值不显示在url中. 1.显示在url中index.html <d ...
- 理解JS中的this的指向
原文地址:https://www.cnblogs.com/pssp/p/5216085.html#1 首先必须要说的是,this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定this到 ...