script/utils/get_stats.py
changeset 891 8628c590f608
parent 467 266c861f293f
equal deleted inserted replaced
890:9c57883dbb9d 891:8628c590f608
     1 
     1 
       
     2 from lxml import etree
     2 import httplib2
     3 import httplib2
     3 import anyjson
     4 import pprint
     4 from lxml import etree
       
     5 import sys
     5 import sys
     6 import pprint
       
     7 
     6 
     8 def get_stats(url):
     7 def get_stats(url):
     9     
     8     
    10     h = httplib2.Http()
     9     h = httplib2.Http()
    11     resp, content = h.request(url)    
    10     _, content = h.request(url)    
    12     #project = anyjson.deserialize(content)
    11     #project = anyjson.deserialize(content)
    13     root = etree.fromstring(content)
    12     root = etree.fromstring(content)
    14 
    13 
    15     #get all annotations
    14     #get all annotations
    16     res_xpath = root.xpath("//ensemble[starts-with(@id,'tweet_')]//element")
    15     res_xpath = root.xpath("//ensemble[starts-with(@id,'tweet_')]//element")