8 Star 0 Fork 8

src-openEuler/python-requests-ftp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
PR28-01-Adding-2-tests-and-updated-statud_code-build.patch 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
朱春意 提交于 2019-11-06 19:50 . update code
diff -purN requests-ftp-0.3.1.orig/requests_ftp/ftp.py requests-ftp-0.3.1/requests_ftp/ftp.py
--- requests-ftp-0.3.1.orig/requests_ftp/ftp.py 2015-08-13 16:57:27.000000000 -0400
+++ requests-ftp-0.3.1/requests_ftp/ftp.py 2018-08-02 10:13:15.801731787 -0400
@@ -99,7 +99,7 @@ def build_text_response(request, data, c
def build_binary_response(request, data, code):
'''Build a response for data whose encoding is unknown.'''
- return build_response(request, data, code, None)
+ return build_response(request, data, code, None)
def build_response(request, data, code, encoding):
@@ -113,7 +113,8 @@ def build_response(request, data, code,
response.raw = data
response.url = request.url
response.request = request
- response.status_code = int(code.split()[0])
+ last_valid_line_from_code = [line for line in code.split('\n') if line][-1]
+ response.status_code = int(last_valid_line_from_code.split()[0])
if hasattr(data, "content_len"):
response.headers['Content-Length'] = str(data.content_len)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/python-requests-ftp.git
git@gitee.com:src-openeuler/python-requests-ftp.git
src-openeuler
python-requests-ftp
python-requests-ftp
master

搜索帮助