Below is what my response.info() gives when I attempt login.. There is no 'set-cookie' header at all in the response. :-(
Date: Mon, 28 Apr 2008 14:30:47 GMT
Content-Length: 6286
Content-Type: text/html; charset=utf-8
Expires: Mon, 28 Apr 2008 14:30:47 GMT
Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
Connection: close
Server: Apache
X-Powered-By: PHP/5.2.5
Content-Language: ml
Vary: Accept-Encoding,Cookie
X-Vary-Options: Accept-Encoding;list-contains=gzip,Cookie;string-contains=mlwiki
Token;string-contains=mlwikiLoggedOut;string-contains=mlwiki_session;string- cont
ains=centralauth_Token;string-contains=centralauth_Session;string-contains=c entr
alauth_LoggedOut
Content-Encoding: gzip
X-Cache: MISS from sq33.wikimedia.org
X-Cache-Lookup: MISS from sq33.wikimedia.org:3128
X-Cache: MISS from sq24.wikimedia.org
X-Cache-Lookup: MISS from sq24.wikimedia.org:80
Via: 1.0 sq33.wikimedia.org:3128 (squid/2.6.STABLE18), 1.0 sq24.wikimedia.org:80
(squid/2.6.STABLE18), 1.0 proxyqh01 (NetCache NetApp/6.0.5), 1.1 proxyin11 (Net
Cache NetApp/6.0.5)
Below is the postData function that I have tweaked
def postData(self, address, data,
contentType='application/x-www-form-urlencoded',
sysop=False, useCookie=True, compress=True):
req=urllib2.Request('http://' + self.hostname() + address)
req.add_unredirected_header('Content-Length', str(len(data)))
req.add_header('Content-type', contentType)
req.add_header('User-agent', useragent)
if useCookie and self.cookies(sysop = sysop):
req.add_header('Cookie', self.cookies(sysop = sysop))
if compress:
req.add_header('Accept-encoding', 'gzip')
req.add_data(data)
cookies = urllib2.HTTPCookieProcessor()
opener = urllib2.build_opener(cookies)
response = opener.open(req)
data = response.read()
if compress:
print response.info()
headers = str(response.info()).split('\n')
for i in headers:
if i.startswith('Content-Encoding: gzip'):
data = decompress_gzip(data)
data = data.decode(self.encoding())
response.close()
self._getUserData(data, sysop = sysop)
return response, data
Any help would be much appreciated !
Regards,
Jacob
_____
From: Jacob Jose [mailto:jacob@ti.com] Sent: Sunday, April 27, 2008 7:54 PM To: 'pywikipedia-l@lists.wikimedia.org' Subject: Login from behind Proxy
Hi all,
I operate my bot - DragonBot - in wikipedias. Until a week or so back, my bot could login to wikipedias and wiktionaries from behind a proxy - by tweaking the wikipedia.py post function . Now I observe that it can't login.
1. My source code hasn't changed. 2. I tried with the 24-Apr Nightly codebase as well.
Has something been changed in the wikipedia server configuration? Say, disabling proxy caching or something like that at the server..
Regards,
Jacob
pywikipedia-l@lists.wikimedia.org