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

Conversation

kanghyojun
Copy link
Member

Close #54

@kanghyojun kanghyojun added the bug label Feb 7, 2017
@kanghyojun kanghyojun self-assigned this Feb 7, 2017
@kanghyojun kanghyojun requested a review from dahlia February 7, 2017 14:19
nirum/rpc.py Outdated
if 200 <= response.status < 300:
response_code = response.code if hasattr(response, 'code') \
else response.status
if 200 <= response_code < 300:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그냥 if 200 <= response.code < 300:으로 하면 안되나요?

테스트해보니 .code가 모든 파이썬 버전에서 호환됩니다:

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen


response = urlopen('http://www.spoqa.com/')
assert response.code == 200
[tox]
envlist = py26, py27, py33, py34, py35, py36, pypy, pypy3
skipsdist = true

[testenv]
commands = python t.py
$ detox
py26 create: /private/tmp/response-code-test/.tox/py26
py27 create: /private/tmp/response-code-test/.tox/py27
py33 create: /private/tmp/response-code-test/.tox/py33
py34 create: /private/tmp/response-code-test/.tox/py34
py35 create: /private/tmp/response-code-test/.tox/py35
py36 create: /private/tmp/response-code-test/.tox/py36
pypy create: /private/tmp/response-code-test/.tox/pypy
pypy3 create: /private/tmp/response-code-test/.tox/pypy3
py27 runtests: PYTHONHASHSEED='3903675250'             
py27 runtests: commands[0] | python t.py               
py26 runtests: PYTHONHASHSEED='3903675250'                        
py26 runtests: commands[0] | python t.py                          
py33 runtests: PYTHONHASHSEED='3903675250'                        
py33 runtests: commands[0] | python t.py                    
py34 runtests: PYTHONHASHSEED='3903675250'                  
py34 runtests: commands[0] | python t.py              
py36 runtests: PYTHONHASHSEED='3903675250'            
py36 runtests: commands[0] | python t.py  
py35 runtests: PYTHONHASHSEED='3903675250'
py35 runtests: commands[0] | python t.py  
pypy runtests: PYTHONHASHSEED='3903675250'      
pypy runtests: commands[0] | python t.py
pypy3 runtests: PYTHONHASHSEED='3903675250'
pypy3 runtests: commands[0] | python t.py
___________________________________ summary ____________________________________
  py26: commands succeeded
  py27: commands succeeded
  py33: commands succeeded
  py34: commands succeeded
  py35: commands succeeded
  py36: commands succeeded
  pypy: commands succeeded
  pypy3: commands succeeded
  congratulations :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kanghyojun kanghyojun merged commit e6d036b into nirum-lang:master Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0