Python HTTP request

By Sergio Filho, ago, written in Python.
URL http://pastecode.org/index.php/view/92017178
Download Paste or View RawExpand paste to full width of browser | Change Viewing Options
  1. import urllib2
  2. import base64
  3.  
  4. req = urllib2.Request('http://testeserjaum.appspot.com/')
  5. req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
  6. #base64string = base64.encodestring('%s:%s' %('user', 'pass'))
  7. #print base64string
  8. #req.add_header("Authorization", "Basic %s" %base64string)
  9. lol = urllib2.urlopen(req)
  10. print lol.read()

Here you can reply to the paste above

Make Private

   

Feeling clever? Set some advanced options.