from suds import WebFault
from suds.client import Client
from cookielib import Cookie
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
client = Client(url)
loginResult = client.service.Login(username, password)
print "=========================================="
print client.options.transport.cookiejar
DEBUG:suds.transport.http:sending:
URL:http://127.0.0.1:34014
HEADERS: {'SOAPAction': u'""', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': u'""'}
DEBUG:suds.transport.http:received:
CODE: 200
HEADERS: {
'set-cookie': 'srv=869aa1577003769cbff7962d77641c4ae9134ac4;Domain=...;Path=/;Version=1;Max-Age=3600',
'content-length': '440',
'content-type': 'text/xml; charset=utf-8',
'connection': 'close',
'server': 'soap/1.9'
}
==========================================
<cookielib.CookieJar[]>
==========================================
None
答案 0 :(得分:0)
如果client.options.transport.cookiejar,则表示cookielib无法从响应中创建cookie。您应该在cookielib中查看cookie验证