** Pastebin PRO Accounts Spring Special ** Get 40% discount for a limited time only! Click Here to check it out ;-)Want more features on Pastebin? Sign Up, it's FREE!


By: Krenair on Apr 1st, 2012  |  syntax: Python  |  size: 0.24 KB  |  views: 200  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class MyHTTPRedirectHandler(urllib2.HTTPRedirectHandler):
  2.     def redirect_request(self, req, fp, code, msg, headers, newurl):
  3.         request = urllib2.Request(newurl)
  4.         request.get_method = lambda: req.get_method()
  5.         return request
clone this paste RAW Paste Data