I'm writing some script, that works with web-servers.
So, I have the following code:
client = suds.client.Client(WSDLfile)
client.service.Login('mylogin', 'mypass')
print client.options.transport.cookiejar
#######
sessnum = str(client.options.transport.cookiejar).split(' ')[1]
client = suds.client.Client( WSDLfile, headers= { 'Set-Cookie' : sessnum } )
When开发者_如何学编程 running in FreeBSD, it returns
<cookielib.CookieJar[<Cookie sessnum=9WAXQ25D37XY535F6SZ3GXKSCTZG8CVJ for .IP.IP.IP.IP/>]>
but in Windows it returns
<cookielib.CookieJar[]>
How can I fix it?
AFAIK client.options.transport.cookiejar is an iterable so what happens on each system when you have:
for c in client.options.transport.cookiejar:
print client.options.transport.cookiejar
Failing that, what if in your Windows system you don't have cookies allowed? That may stop the session from being saved.
精彩评论