perseus place restful api客户端python库

perseus-place-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 theio的标签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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何将java ArrayList对象转换为实际值   web服务如何在JAVA类uisng JAXBElement中解组SOAP UI值   包含无值参数的java HttpClient表单URL   运行简单Camel Restlet演示项目的java问题?   带有自定义图标的java简单SWT警报消息?   java Netbeans 6.8:LibImport可以工作,但编译时“包不存在”   java如何获得绘画完成的通知?   java Hazelcast客户端模式群集故障后如何恢复?   Neo4J中Shapefile的java批插入   为什么ThreadPoolExecutor在Eclipse和从命令行运行Java程序时表现不同?   java在Android中计算两个坐标之间的距离时得到了荒谬的值   java在CardLayout中显示卡本身的下一张卡