Mercurial > eagle-eye
diff pyikriam/ikariam.py @ 218:785c89e5db32
Remove those file, and change the addheader from fake moz
author | kevin@localhost.localdomain |
---|---|
date | Tue, 04 Nov 2008 16:01:25 +0800 |
parents | 9f248c8460ce |
children | 7107c26ba197 |
line wrap: on
line diff
--- a/pyikriam/ikariam.py Tue Nov 04 15:13:46 2008 +0800 +++ b/pyikriam/ikariam.py Tue Nov 04 16:01:25 2008 +0800 @@ -11,12 +11,15 @@ class fake_moz(object): __metaclass__ = decorator - def __init__(self): + def __init__(self,headers=0): + fakeheaders=[('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.1.12pre) Gecko/20071220 BonEcho/2.0.0.12pre')] + if headers: + fakeheaders=fakeheaders+headers super(fake_moz, self).__init__() cookie_jar = cookielib.LWPCookieJar() cookie_proc = urllib2.HTTPCookieProcessor(cookie_jar) opener = urllib2.build_opener(cookie_proc) - opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.1.12pre) Gecko/20071220 BonEcho/2.0.0.12pre')] + opener.addheaders = fakeheaders fake_moz.set_backend(self, opener) self.cookie_jar = cookie_jar pass @@ -29,16 +32,14 @@ COOKIEFILE = '/tmp/ikariam.lwp' def __init__(self): - browser = fake_moz() - self.browser = browser - self._cookie_jar = browser.cookie_jar + self.browser = fake_moz() + self._cookie_jar = self.browser.cookie_jar if os.path.isfile(self.COOKIEFILE): self._cookie_jar.load(self.COOKIEFILE) pass - urllib2.install_opener(browser) - + urllib2.install_opener(self.browser) self.confdata=LoadConfigfile().cd self.baseurl='http://'+self.confdata['server']