Python Windows和FreeBSD中脚本的不同工作

Python Windows和FreeBSD中脚本的不同工作,python,cookies,suds,Python,Cookies,Suds,我正在写一些脚本,可以与web服务器一起使用 因此,我有以下代码: 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.Cl

我正在写一些脚本,可以与web服务器一起使用

因此,我有以下代码:

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 } )
在FreeBSD中运行时,它返回

<cookielib.CookieJar[<Cookie sessnum=9WAXQ25D37XY535F6SZ3GXKSCTZG8CVJ for .IP.IP.IP.IP/>]>
<cookielib.CookieJar[]>

但在Windows中它会返回

<cookielib.CookieJar[<Cookie sessnum=9WAXQ25D37XY535F6SZ3GXKSCTZG8CVJ for .IP.IP.IP.IP/>]>
<cookielib.CookieJar[]>


如何修复它?

AFAIK client.options.transport.cookiejar是一个可移植的工具,因此,如果您有:

for c in client.options.transport.cookiejar:
    print client.options.transport.cookiejar

否则,如果在Windows系统中不允许使用cookie怎么办?这可能会停止保存会话。

您在Windows端得到的实际响应是什么?另外,查看您在两个平台上发送的请求,看看它们是否有任何不同:导入日志;logging.getLogger('suds.client').setLevel(logging.DEBUG);logging.getLogger('suds.transport').setLevel(logging.DEBUG)。