标签:import pat url int rtp lin tar tpm payment
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))
标签:import pat url int rtp lin tar tpm payment
原文地址:https://www.cnblogs.com/yspass/p/8797029.html