import urllib2 import StringIO class TestCase: def crash3(self): """ Whore the CPU.""" url = "http://hunteros.com/?id=amateur" content = self.get_content(url) print "Got content." def get_content(self, url): """ Gets a StringIO object for the given URL. """ req = urllib2.Request(url) req.add_header('User-agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)') response = urllib2.urlopen(req) content = response.read() return StringIO.StringIO(content) test = TestCase() test.crash3()