8000 Response object compabtibility by kanghyojun · Pull Request #55 · nirum-lang/nirum-python · GitHub
[go: up one dir, main page]

Skip to content

Response object compabtibility #55

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 3 commits into from
Feb 8, 2017
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 nirum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
~~~~~~~~~~~~~~~

"""
__version_info__ = 0, 3, 5
__version_info__ = 0, 3, 6
__version__ = '.'.join(str(v) for v in __version_info__)
2 changes: 1 addition & 1 deletion nirum/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def do_request(self, request_url, payload):
request.add_header(header_name, header_content)
response = self.opener.open(request, None)
response_text = response.read()
if 200 <= response.status < 300:
if 200 <= response.code < 300:
return response_text.decode('utf-8')
else:
raise UnexpectedNirumResponseError(response_text)
Expand Down
5 changes: 4 additions & 1 deletion nirum/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import socket

from six import PY3
from six.moves import urllib
from six.moves.http_client import HTTPResponse
from werkzeug.test import Client
Expand All @@ -15,7 +16,9 @@ class MockHttpResponse(HTTPResponse):

def __init__(self, body, status_code):
self.body = body
self.status = status_code
self.code = status_code
if PY3:
self.status = status_code

def read(self):
return self.body.encode('utf-8')
Expand Down
0