拉取数据经典版

Posted zhangning

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了拉取数据经典版相关的知识,希望对你有一定的参考价值。

技术分享图片
 1 #! /usr/bin/env python
 2 # coding=utf-8
 3 import pymysql
 4 import json
 5 import urllib
 6 import time
 7 import urllib2
 8 import urllib
 9 import datetime
10 
11 url=http://engine.dashboard.sh2.ctripcorp.com:8080/jsonp/getgroupeddatapoints?reqdata={"version":1,"time-series-pattern":{"namespace":"ns-null","metrics-name":"payment.switch.rtpmonitor.metric.cost","tag-search-part":{}},"aggregator":{"accept-linear-interpolation":true,"function":"sum"},"downsampler":{"interval":"1d","function":"sum"},"max-datapoint-count":100,"start-time":"2018-04-10 00:00:00","end-time":"2018-04-11 00:00:00","rate":false,"group-by":["collectionid"],"maxGroupCount":100}
12 page=urllib.urlopen(url)
13 data=page.read()
14 json_data=json.loads(data)
15 local_data=json_data[time-series-group-list]
16 collectionid_total =[]
17 num_total =[]
18 for item in local_data:
19     collectionid = item["time-series-group"]["collectionid"]
20     num = item["data-points"]["total"]
21     collectionid_total.append(collectionid)
22     num_total.append(num)
23 print(zip(collectionid_total,num_total))
View Code

 

以上是关于拉取数据经典版的主要内容,如果未能解决你的问题,请参考以下文章

十大经典排序算法动画与解析,看我就够了!(配代码完全版)

十大经典排序算法动画与解析,看我就够了!(配代码完全版)

[vscode]--HTML代码片段(基础版,reactvuejquery)

(附代码)动图图解 | 十大经典排序算法Python版实现

几个关于js数组方法reduce的经典片段

lyt经典版MySQL基础——函数