开发者

Different work of the script in Windows and in FreeBSD

开发者 https://www.devze.com 2022-12-31 07:25 出处:网络
I\'m writing some script, that works with web-servers. So, I have the following code: client = suds.client.Client(WSDLfile)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号