Skip to content
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

Reuse stdlib HTTP response codes dictionary #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 6 additions & 9 deletions brubeck/request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def coro_spawn(function, app, message, *a, **kw):
raise EnvironmentError('You need to install eventlet or gevent')


try:
from http.client import responses
except ImportError:
from httplib import responses

from . import version

import re
Expand Down Expand Up @@ -356,15 +361,7 @@ class WebMessageHandler(MessageHandler):
_NOT_ALLOWED = 405
_SERVER_ERROR = 500

_response_codes = {
200: 'OK',
400: 'Bad request',
401: 'Authentication failed',
403: 'Forbidden',
404: 'Not found',
405: 'Method not allowed',
500: 'Server error',
}
_response_codes = responses

###
### Payload extension
Expand Down