Python sdk文档中尖括号如何处理,pythonsdk文档括号,比如下面这样的数据
Python sdk文档中尖括号如何处理,pythonsdk文档括号,比如下面这样的数据
比如下面这样的数据
<!doctype html> <html xmlns:ng="http://angularjs.org"> <body> Hello {{'World'}}! <script src="http://code.angularjs.org/angular.js"></script> <script> angular.element(document).ready(function() { angular.bootstrap(document); }); </script> </body> </html>
我想通过StringIO的方式保存到七牛云存储,得到不同的结果
如果是通过文件上传的,存储过程正常如果是通过post方式在字段中提交的,存储过程失败,返回的错误信息为limited mimeType: ExpUser can only upload image/audio/video/plaintext, reqid:vxUAAPAePxkbbJQT,但是hard code去掉尖括号,就正常了实现的代码参考了七牛python sdk的文档
policy = qiniu.rs.PutPolicy(bucket_name)uptoken = policy.token()extra = qiniu.io.PutExtra()extra.mime_type = "text/plain"extra.params = {'x:a': 'a'}data = u"""## 概览 <!doctype html> <html xmlns:ng="http://angularjs.org"> <body> Hello {{'World'}}! <script src="http://code.angularjs.org/angular.js"></script> <script> angular.element(document).ready(function() { angular.bootstrap(document); }); </script> </body> </html>下面是一些你的代码必须遵守的顺序:1. 等页面和所有的脚本加载完之后,找到HTML模板的根节点——通常就是文档的根节点。2. 调用 api/angular.bootstrap将模板编译成可执行的、数据双向绑定的应用程序。<span class="doc-copyright">**版权声明:** **中文文档[AngularJS中文社区][]** && **英文文档[AngularJS官网][]** && **代码许可[The MIT License][]** && **文档许可[CC BY 3.0][]**</span>""""data = data.strip().encode('utf-8')data = str(data)strio = StringIO.StringIO()strio.write(data)result, error = qiniu.io.put(uptoken, 'xxx', strio, extra)print error
不知道怎么解决...请教
报这个错limited mimeType: ExpUser can only upload image/audio/video/plaintext,说明你是体验用户,七牛服务更具内容判断你上传的字段并不是plaintext,而是html文件(体验用户是上传不了html文件的),导致了上传失败,所以建议你通过以下身份认证成为标准用户,就可以避免遮掩的情况发生了。
编橙之家文章,
相关内容
- 为什么读取通过cookielib方法得到的cookies返回值是空的
- 请教Python分布式实现一个helloworld的思路,pythonhellowor
- Python syslog模块怎么判断发送状态,pythonsyslog,syslog服务
- Python class Vector 的创建,pythonvector,创建一个向量的cla
- Python 源码中的re表达式同原生字符是怎么匹配成功的,
- Mac python2.7.3创建虚拟环境提示ImportError: No module named .
- PythonGIL与线程安全问题?,pythongil安全问题,由于一些历
- Pythom Scrapy框架Imagepipeline组件下载gif类型文件处理问题
- 同一个程序在python2.7.3与2.7.2环境运行会出现不同结果吗
- Python SocketServer模块代理通讯加密问题新人求指点,py
评论关闭