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

Status Code 425 named incorrectly #6584

Closed
mephinet opened this issue Nov 24, 2023 · 4 comments
Closed

Status Code 425 named incorrectly #6584

mephinet opened this issue Nov 24, 2023 · 4 comments

Comments

@mephinet
Copy link

HTTP status code 425 is defined as "too early". While the defining RFC defines the code in the context of TLS, I regularly find APIs that use this status code to indicate to a client that an asynchronous job that has been started is still being processed, so the result can not yet be provided.

requests.status_codes however doesn't know the reason "too early", and instead calls 425 "unordered_collection" and "unordered". I believe, this is a bug.

The defendent: https://github.com/psf/requests/blob/main/src/requests/status_codes.py#L82

I call to the witness stand:

Expected Result

requests.codes.get("TOO_EARLY")
425

Actual Result

requests.codes.get("TOO_EARLY")

Reproduction Steps

import requests

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "3.3.0"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.4"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.11.6"
  },
  "platform": {
    "release": "6.6.1-arch1-1",
    "system": "Linux"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.31.0"
  },
  "system_ssl": {
    "version": "30100040"
  },
  "urllib3": {
    "version": "2.0.7"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}
@sigmavirus24
Copy link
Contributor

I would merge a change to add that to the type definition. Keep in mind unordered was in wide use before that rfc though which is why it has that definition. I doubt anyone is using it from us but we can't remove it.

@atatuzuner61
Copy link
Contributor

Implementing this in an upcoming PR.

@atatuzuner61
Copy link
Contributor

atatuzuner61 commented Dec 4, 2023

Here is a PR with relevant changes that I believe are backwards compatible and generalizable. Could you take a look and give your initial thoughts? @nateprewitt

@nateprewitt
Copy link
Member

Resolving now that #6592 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@sigmavirus24 @mephinet @nateprewitt @atatuzuner61 and others