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 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通过Spring MVC web应用程序向客户端发送文本文件   java是否可以在运行时动态实例化DAO类?   调用VB。来自Java的net函数   java在Android中通过单击打开特定文件夹   java如何使用maven pom。xml标识非标准项目结构中的testng测试用例?   java为什么FOP在大文件上崩溃?   Architecture python+flask和spring boot+java   java Kafka工具根本没有启动Ubuntu 19.10   如何使用Eclipse运行Java USB API for Windows   java如何在Eclipse中查看J2EE预览服务器/容器的日志/控制台?   网页抓取是否可以使用Java crawler crawler4j暂停和恢复抓取?   java当我第二次按下按钮时,应用程序停止工作   带有偏移量和限制的java SQLite分页问题   java如何在OSX mavericks中将端口80转发到8080   java从泛型方法调用非泛型方法   java My代码未按预期工作。十进制输出不是它应该的样子   节点。java中的js加密(jasypt)和nodejs中的解密   java乘法表不工作数组索引超出范围   java将JDBC与Firebirdsql连接起来