perseus restful api客户端python库
perseus-restful-api-client-librar的Python项目详细描述
perseus restful api客户端python库
提供pythonic接口以连接到使用perseus restful api框架开发的restful api服务器的类的存储库。
python库Poster 0.8.1
注意:这个库包含了poster 0.8.1
的修改版本,它的原始版本提供了一组类和函数,以便于使用标准的多部分/表单数据编码发出http post(或put)请求。
原始库poster 0.8.1
不能用于上载上载到内存中的文件(即流到内存),例如django InMemoryUploadedFile
。原因是此类类文件对象不支持poster 0.8.1
用于确定要在python模块中上载的类文件对象的大小的方法poster.encode
:
iffileobjisnotNoneandfilesizeisNone:# Try and determine the file sizetry:self.filesize=os.fstat(fileobj.fileno()).st_sizeexcept(OSError,AttributeError):try:fileobj.seek(0,2)self.filesize=fileobj.tell()fileobj.seek(0)except:raiseValueError("Could not determine filesize")
这段代码引发了io.UnsupportedOperation
异常,该异常poster 0.8.1
无法捕获。chris atlee把alon hammerman的补丁放在图书馆``poster, for catching the
io的标签tip
中。2013-03-12不支持fileno的操作:
try:fromioimportUnsupportedOperationexceptImportError:UnsupportedOperation=None(...)iffileobjisnotNoneandfilesizeisNone:# Try and determine the file sizetry:self.filesize=os.fstat(fileobj.fileno()).st_sizeexcept(OSError,AttributeError,UnsupportedOperation):try:fileobj.seek(0,2)self.filesize=fileobj.tell()fileobj.seek(0)except:raiseValueError("Could not determine filesize")
但是,可以用pip
安装的最新版本poster
仍然是0.8.1
。