相关疑难解决方法(0)

我怎样才能泡泡沫?

为了避免在开发过程中反复访问SOAP服务器,我正在尝试缓存结果,这样我就可以运行其余的代码,而无需每次都查询服务器.

使用下面的代码,我得到一个PicklingError: Can't pickle <class suds.sudsobject.AdvertiserSearchResponse at 0x03424060>: it's not found as suds.sudsobject.AdvertiserSearchResponse当我尝试挑选肥皂水果的结果.我想这是因为这些类是动态创建的.

import pickle
from suds.client import Client

client = Client(...)
result = client.service.search(...)

file = open('test_pickle.dat', 'wb')
pickle.dump(result, file, -1)
file.close()
Run Code Online (Sandbox Code Playgroud)

如果我删除-1协议版本 pickle.dump(result, file, -1),我会得到一个不同的错误:

TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled
Run Code Online (Sandbox Code Playgroud)

酸洗是正确的吗?我可以让它运作吗?有没有更好的办法?

python soap pickle suds

8
推荐指数
1
解决办法
4196
查看次数

标签 统计

pickle ×1

python ×1

soap ×1

suds ×1