Skip to content

忽略4xx的重试 #121

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 6 commits into from
Jul 2, 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
2 changes: 1 addition & 1 deletion qiniu/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def put(uptoken, key, data, extra=None):
{'filename': fname, 'data': data, 'mime_type': extra.mime_type},
]
ret, err, code = rpc.Client(conf.UP_HOST).call_with_multipart("/", fields, files)
if err is None or code == 571 or code == 614 or code == 301:
if err is None or code / 100 == 4 or code == 579 or code / 100 == 6 or code / 100 == 7:
return ret, err

ret, err, code = rpc.Client(conf.UP_HOST2).call_with_multipart("/", fields, files)
Expand Down
2 changes: 1 addition & 1 deletion qiniu/resumable_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def put(uptoken, key, f, fsize, extra):
host = conf.UP_HOST
try:
ret, err, code = put_with_host(uptoken, key, f, fsize, extra, host)
if err is None or code == 571 or code == 614 or code == 301:
if err is None or code / 100 == 4 or code == 579 or code / 100 == 6 or code / 100 == 7:
return ret, err
except:
pass
Expand Down
11 changes: 0 additions & 11 deletions qiniu/test/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,6 @@ def test_put_fail_reqid(self):
ret, err = io.put("", key, data, extra)
assert "reqid" in err

def test_put_with_uphost2(self):
conf.UP_HOST = "api.qiniu.com" # mistake up host
localfile = "%s" % __file__
key = "test_up2_%s" % r(9)

extra.check_crc = 1
ret, err = io.put_file(policy.token(), key, localfile, extra)
assert err is None
assert ret['key'] == key
conf.UP_HOST = "up.qiniu.com"


class Test_get_file_crc32(unittest.TestCase):

Expand Down