抖动
#! /usr/bin/env python #coding=utf-8 import json import urllib url = 'http://engine.dashboard.sh2.ctripcorp.com:8080/jsonp/getgroupeddatapoints?callback=jQuery19101382019256707281_1504157613070&_=1504157613080&reqdata={"version":1,"time-series-pattern":{"namespace":"ns-null","metrics-name":"fx.clog.loglevel.count","tag-search-part":{"level":["ERROR","FATAL"],"appId":["100010071","100009791","100009683","100009473","100009344","100009114","100009076","100009075","100008936","100008766","100008741","100008740","100008728","100008644","100008499","100008420","100008419","100008415","100008340","100008316","100008296","100008244","100008223","100008058","100008047","100007770","100007733","100007578","100007535","100007532","100007285","100007275","100007123","100007104","100007102","100007061","100007000","100006999","100006950","100006913","100006912","100006883","100006882","100006709","100006470","100006419","100006418","100006416","100006415","100006414","100006413","100006412","100006411","100006410","100006409","100006407","100006406","100006405","100006404","100006403","100006318","100006307","100006308","100006304","100006295","100006294","100006157","100006090","100006087","100006088","100006085","100006086","100006083","100006069","100005998","100005930","100005526","100005500","100005392","100005320","100005293","100005292","100005291","100005184","100005088","100004948","100004884","100004880","100004813","100004812","100004743","100004683","100004617","100004508","100004500","100004399","100004252","100004223","100004171","100004164","100004137","100004122","100004117","100004066","100004006","100004005","100004004","100003997","100003993","100003820","100003735","100003727","100003737","100003693","100003648","100003625","100003559","100003561","100003551","100003501","100003416","100003396","100003369","100003323","100003324","100003318","100003280","100003284","100003285","100003264","100003238","100003240","100003213","100003167","100003156","100003151","100003132","100003131","100003130","100003134","100003135","100003122","100003028","100003029","100003045","100002954","100002958","100002961","100002928","100002890","100002809","100002745","100002721","100002717","100002718","100002719","100002672","100002674","100002683","100002654","100002655","100002635","100002597","100002230","100001951","100001815","100001756","100001553","100001519","100001520","100001506","100001458","100001459","100001426","100001420","100001356","100001353","100001340","410444","100001271","100001272","100001260","100001251","100001248","100001244","100001245","100001252","100001254","100001255","100001256","100001231","100001229","100001230","100001199","100001163","100001164","100001165","100001166","100001167","100001169","100001170","100001135","100001136","100001140","100001141","100001142","100001143","100001131","100001080","100000852","100000853","100000578","410612","410901","410902","410903","410904","410906","410907","410910","100000170","440101","410211","410205","410457","410204","410206","410103","410207","410208","410209","410430","410439","410440","410426","410425","4104124","410445","410436","410435","415148","415141","410477","410488","410470","410472","410201","410438","410443","410409","410471","410473","411003","410203","410213","410402","410403","410404","410408","410410","410411","410412","410413","410416","410417","410418","410419","410420","410487","411004","415101","415140","415142","415144","415147","415149","4104101","100000008","100000009","100000010","100000011","410607"]}},"aggregator":{"accept-linear-interpolation":true,"function":"sum"},"downsampler":{"interval":"1d","function":"sum"},"max-datapoint-count":1440,"start-time":"2017-09-04 16:30:00","end-time":"2017-09-05 16:30:00","rate":false,"group-by":["appId"],"maxGroupCount":1440}' page=urllib.urlopen(url) data=page.read() data1 = '"'+ data +'"' data2=data1.split('"time-series-group-list":')[1] data3=data2.replace('});"',"\'") data4="'" + data3 jsonDic = eval(data4) locations = json.loads(jsonDic) for location in locations: a = location["time-series-group"]["appId"] b = location["data-points"]["total"] inta = a +"\t"+ b +"\n" print(inta) #print(data4) #print(data2.split('"time-series-group-list":')[1])