Skip to content

当网络断开或出错时,不抛出异常 #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## CHANGE LOG

### v6.1.8

2014-08-05 issue [#126](https://github.com/qiniu/python-sdk/pull/126)
- [#125] 网络出错不抛异常

### v6.1.7

2014-07-10 issue [#123](https://github.com/qiniu/python-sdk/pull/123)
- [#121] 上传多host重试
- [#122] 修改上传域名

### v6.1.6

2014-06-30 issue [#118](https://github.com/qiniu/python-sdk/pull/118)
Expand Down
2 changes: 1 addition & 1 deletion qiniu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
'''

# -*- coding: utf-8 -*-
__version__ = '6.1.7'
__version__ = '6.1.8'
7 changes: 4 additions & 3 deletions qiniu/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ def call_with(self, path, body, content_type=None, content_length=None):
if content_length is not None:
header["Content-Length"] = content_length

resp = self.round_tripper("POST", path, body, header)
try:
resp = self.round_tripper("POST", path, body, header)
ret = resp.read()
ret = json.loads(ret)
except IOError, e:
return None, e
except ValueError:
# ignore empty body when success
pass
except Exception, e:
return None, str(e)+path, 0

if resp.status >= 400:
err_msg = ret if "error" not in ret else ret["error"]
Expand Down