Tuesday, September 17, 2013

Reading XML in python

#!/usr/bin/env python

import xml.etree.ElementTree as ET
import httplib
import urllib2
tree = ET.parse('popularity_response.xml')
root = tree.getroot()
print root
for popularity_record in root.findall('POPULARITY_RECORD'):
 print popularity_record.find('FIELD_VALUE').text
 try : 
  response =     urllib2.urlopen(popularity_record.find('FIELD_VALUE').text)
  print response.code
 except urllib2.URLError as e :
  print e
  continue

No comments:

Setting the limits in Linux permanently

https://singztechmusings.wordpress.com/2011/07/11/ulimit-how-to-permanently-set-kernel-limits-in-linux/ app soft nofile   16384 * hard...