You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Adding an HTTPMethod str enum to http in stdlib #91996
The same as http.HTTPStatus but for http methods.
It can be helpful when dealing with the need to explicitly write the http method name, for example, when using urllib3.
When writing HTTP related code its common to explicitly write HTTP methods names as magic strings which are prone to mistypes and errors.
For example a simple search in amazon's botocore (HTTP related code, https://github.com/boto/botocore) for the string 'GET' shows 77 references and a search for 'POST' shows 43 references.
Example of code now: client.request('GET', url, headers=headers)
Illustration of the same code with the new feature: client.request(HTTPMethod.GET, url, headers=headers)
Activity
cibofo commentedon Apr 27, 2022
PR #91997
gh-91996: Add an HTTPMethod StrEnum to http (GH-91997)