Reputation: 83
I'm using Python S60 (PyS60) with Python 2.2 engine. i already have urllib2 module but HTTPCookieProcessor doesn't exist
>>> import urllib2
>>> dir(urllib2)
['AbstractBasicAuthHandler', 'AbstractDigestAuthHandler', 'AbstractHTTPHandler', 'BaseHandler', 'CacheFTPHandler', 'CustomProxy', 'CustomProxyHandler', 'FTPHandler', 'FileHandler', 'GopherError', 'GopherHandler', 'HTTPBasicAuthHandler', 'HTTPDefaultErrorHandler', 'HTTPDigestAuthHandler', 'HTTPError', 'HTTPHandler', 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm', 'HTTPRedirectHandler', 'HTTPSHandler', 'OpenerDirector', 'OpenerFactory', 'ProxyBasicAuthHandler', 'ProxyDigestAuthHandler', 'ProxyHandler', 'Request', 'StringIO', 'URLError', 'UnknownHandler', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', '_opener', 'addinfourl', 'base64', 'build_opener', 'dis', 'encode_digest', 'ftplib', 'ftpwrapper', 'getproxies', 'gopherlib', 'httplib', 'inspect', 'install_opener', 'localhost', 'md5', 'mimetools', 'mimetypes', 'noheaders', 'os', 'parse_http_list', 'parse_keqv_list', 'posixpath', 're', 'rfc822', 'sha', 'socket', 'splitattr', 'splitgophertype', 'splithost', 'splitport', 'splitquery', 'splittype', 'stat', 'sys', 'time', 'token', 'tokenize', 'types', 'unquote', 'unwrap', 'url2pathname', 'urlopen', 'urlparse']
Upvotes: 1
Views: 376
Reputation: 387993
urllib2.HTTPCookieProcessor was added in Python 2.4, so it’s not available in your version of Python. I’d advise you to upgrade to a newer version of Python 2, as Python 2.2 is already nine years old.
I just looked up the PyS60 thing and it seems that there is no newer version (although I’m not sure on that, their version numbering scheme is a bit weird), so you might not be able to upgrade that. What you could try is to backport the HTTPCookieProcessor
type from Python 2.4+. But that might not work if other internals changed that are necessary for that.
Looking at its source (in Python 2.4, to not introduce too many changes from later versions), it does seem very simple, so it might work out well. At least it’s worth a try.
Upvotes: 1