【问题标题】:Different work of the script in Windows and in FreeBSDWindows 和 FreeBSD 中脚本的不同工作
【发布时间】:2010-05-28 19:00:05
【问题描述】:

我正在编写一些适用于网络服务器的脚本。

所以,我有以下代码:

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/>]>

但在 Windows 中它返回

<cookielib.CookieJar[]>

我该如何解决?

【问题讨论】:

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

标签: python cookies suds


【解决方案1】:

AFAIK client.options.transport.cookiejar 是一个可迭代的,所以当你有每个系统时会发生什么:

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

如果做不到这一点,如果在您的 Windows 系统中您不允许使用 cookie,该怎么办?这可能会阻止会话被保存。

【讨论】:

    猜你喜欢
    • 2015-10-07
    • 2014-08-01
    • 2011-04-06
    • 2013-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多