flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

Remove _http Module and replace with builtin HTTP

Open j5awry opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. flask-restx is maintaining a separate backport ENUM of HTTP statuses, _http.py.

This should be replaced with the builtin HTTP module.

Describe the solution you'd like remove _http.py replace references to the status codes in the HTTPStatus class with the builtin HTTP module.

Describe alternatives you've considered

Additional context #262 was opened by a user to backport Python 3.9 status codes into the module. Upon seeing the backport, it struck several of us as odd to have our own backported, vendored file for HTTP status codes. Hence the proposal to move to the builtin

j5awry avatar Dec 17 '20 14:12 j5awry

Is this still a valid requirement? If so, I am willing to solve this one. And, is the requirement to chuck the HTTPStatus class in _http.py and replace the references with the built-in HTTP package of python (https://docs.python.org/3.9/library/http.html#module-http)?

I started working on this and noticed that the tests fail for python 2.7 Interpreter as py27 does not support the http package implicitly. Is there a way to add a package requirement if the environment is 2.7?

shashank152k avatar Mar 25 '21 07:03 shashank152k

I started working on this and noticed that the tests fail for python 2.7 Interpreter as py27 does not support the http package implicitly. Is there a way to add a package requirement if the environment is 2.7?

I wonder if it would make sense to only use the fallback if it's not available? Check if it's Python 2.7 (is that still being supported??) and use the backport, else, use http module.

This way it would at least mean that for supported officially Python 3 versions it would be using the proper http module.

ikornaselur avatar Jun 27 '22 13:06 ikornaselur