Tuesday, September 17, 2013

HTTP Request with headers in Python

#!/usr/bin/env python

import requests
import xml.etree.ElementTree as ET

headers = {'key':'value'}

r = requests.get('www.google.com',auth=('username', 'password'),headers=headers)

print r.text

root = ET.fromstring ( r.text.encode('ascii','ignore'))

for xyz in  root.findall('POPULARITY_RECORD'):
        neoUrl = xyz.find('FIELD_VALUE').text
        print neoUrl
        httpstatus_neo = requests.get(neoUrl)
        print httpstatus_neo.status_code
# print r.text

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...