# -*- coding:UTF-8 -*-
import requests, time
import json
from bs4 import BeautifulSoup as bp t3 = time.time()
ths = [] # 存放线程 def get(num):
n = str(num)
page = requests.post('http://www.employees.org/~dwing/aaaa-stats/',
) # 自定义请求头,这些请求头内容是在浏览器上看到的 t = page.text
# print(t)
soup = bp(t, 'lxml') # 使用beautifulsoup解析xml文件,解析html时,将xml改为lxml
all_body = soup.find_all('tr') # 查找EmailResult标签包含的所有内容,生成一个列表
for info in all_body:
if not info:continue
tds = info.find_all('td')
one_row = []
for i in tds:
if not i:continue
for infos in i:
if not infos:continue
try:
nums = infos.text #所有的数字
if not nums:continue
nums = nums.strip().strip('\n')
# if len(nums) >= 13:continue
if len(nums) == 12:
total_checked = nums[0:5]
with_a_record = nums[5:]
one_row.append(total_checked)
one_row.append(with_a_record)
else:
one_row.append(nums)
# print(nums,'aaa')
except:
one_row.append(infos)
# print(infos, 'lll') # 百分数 if '\n' in one_row:
one_row.remove('\n')
if 'diffs' in one_row:
one_row.remove('diffs')
if '(large run)' in one_row:
continue
else:
if one_row:
if len(one_row) == 16:
all_data = {}
all_data['date'] = one_row[0]
all_data['total_checked'] = one_row[1]
all_data['with_A_records_count'] = one_row[2]
all_data['with_A_records_rate'] = one_row[3]
all_data['with_AAAA_records_count'] = one_row[4]
all_data['with_AAAA_records_rate'] = one_row[5]
all_data['AAAA_with_IPv4-mapped_count'] = one_row[6]
all_data['AAAA_with_IPv4-mapped_rate'] = one_row[7]
all_data['AAAA_with_loopback_count'] = one_row[8]
all_data['AAAA_with_loopback_rate'] = one_row[9]
all_data['valid_AAAA_records_count'] = one_row[10]
all_data['valid_AAAA_records_rate'] = one_row[11]
all_data['IPv6_connection_ok_count'] = one_row[12]
all_data['IPv6_connection_ok_rate'] = one_row[13]
all_data['IPv6_connection_failed_count'] = one_row[14]
all_data['IPv6_connection_failed_rate'] = one_row[15]
# print(one_row)
ddd = json.dumps(all_data, indent=2,
ensure_ascii=False) # ensure_ascii=False :防止将文字转成unicoe with open('dns_status.txt', 'a+') as f:
f.write(ddd)
# print(i.text,'lll') get(1) t4 = time.time()
tt = t4 - t3
print(tt)

结果见github

获取全球dns统计信息的更多相关文章

  1. Docker swarm 获取service的container信息

    我们可以通过docker service create创建服务,例如: docker service create --name mysql mysql:latest 服务创建好后,如何来获取该ser ...

  2. Oracle 11g系统自己主动收集统计信息的一些知识

    在11g之前,当表的数据量改动超过总数据量的10%,就会晚上自己主动收集统计信息.怎样推断10%.之前的帖子有研究过:oracle自己主动统计信息的收集原理及实验.这个STALE_PERCENT=10 ...

  3. PLSQL_统计信息系列06_统计信息的历史和日志

    20150506 Created By BaoXinjian

  4. python之微信好友统计信息

    需要安装库:wxpy 代码如下: from wxpy import Bot,Tuling,embed,ensure_one bot = Bot(cache_path=True) #获取好友信息 bot ...

  5. [20190505]关于latch 一些统计信息.txt

    [20190505]关于latch 一些统计信息.txt --//我在两篇文章,提到一些latch的统计信息.链接如下:http://blog.itpub.net/267265/viewspace-2 ...

  6. Oracle重新获取统计信息以及SQLSERVER重建索引

    Oracle重新获取统计信息 exec dbms_stats.gather_schema_stats(ownname =>'LCoe739999',options => 'GATHER', ...

  7. Oracle 和 SQLSERVER 重新获取统计信息的方法

    1. Oracle 重新获取统计信息的命令 exec dbms_stats.gather_schema_stats(ownname =>) # 需要修改 ownername options 指定 ...

  8. 使用ioctl获取网卡统计信息

    ethtool -S获取接口统计信息总共分三步: 1.获取统计项个数,使用SIOCETHTOOL+ETHTOOL_GSSET_INFO 2.(可选)获取统计项名字,使用SIOCETHTOOL+ETHT ...

  9. 通过API获取统计信息时报Access denied错误处理记录

    通过API获取HDFS统计信息时报Access denied错误信息,错误信息如下: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.s ...

随机推荐

  1. .NET平台的资源文件管理

    可以管理文本.图片等不同类型的资源 管理方式(增删改) 可以直接修改XXX.resx源文件(XML格式,文本直接管理内容,图片需要指定路径,资源名和图片名可以不同) 也可以在VS的可视化界面上进行操作 ...

  2. php代码审计7审计csrf漏洞

    跨站请求伪造,也有人写出xsrf,黑客伪造用户的http请求,然后将http请求发送给存在csrf的网站,网站执行了伪造的http请求,就引发了跨站请求伪造 漏洞危害:攻击者盗用了你的身份信息,以你的 ...

  3. count failed: not master{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } at src/mongo/shell/query.js:191在SECONDARY节点无法show dbs

    count failed: not master{ "note" : "from execCommand", "ok" : 0, " ...

  4. linux负载均衡与性能监控

    平均负载是单位时间内, 系统处于可运行状态和不可中断状态的平均进程数( 平均活跃进程数 ) 可运行状体好理解, 就是进程正在运行状态Running和可运行状态Runnable... 这里需要注意的是 ...

  5. BZOJ3156 防御准备 斜率优化dp

    Description   Input 第一行为一个整数N表示战线的总长度. 第二行N个整数,第i个整数表示在位置i放置守卫塔的花费Ai. Output 共一个整数,表示最小的战线花费值. Sampl ...

  6. ssh 远程登录TX2

    TX2 端SSH操作 安装: sudo apt-get install openssh-server 确认sshserver是否启动: ps -e |grep ssh 如果看到sshd那说明ssh-s ...

  7. Qt 学习之路 2(50):自定义可编辑模型

    Home / Qt 学习之路 2 / Qt 学习之路 2(50):自定义可编辑模型 Qt 学习之路 2(50):自定义可编辑模型 豆子 2013年5月13日 Qt 学习之路 2 13条评论 上一章我们 ...

  8. 最近研究了一个.NET的DHT网络搜索引擎,顺便重新整理了下引擎思路,供大家分享讨论下。

    最近研究了一个.NET的DHT网络搜索引擎,顺便重新整理了下引擎思路,供大家分享讨论下.

  9. Intelligent Poetry

    Readme: Creat poems. import re import random from collections import Counter def Creat_Poem(number): ...

  10. vue的eventBus

    首先在main.js中 Vue.prototype.$eventBus = new Vue() A组件中通过触发事件或者其他什么,然后发射数据 this.$eventBus.$emit('key',' ...