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

Raise UploadError when HTTP 308 occurs when publishing #3315

Closed
wants to merge 1 commit into from
Closed

Raise UploadError when HTTP 308 occurs when publishing #3315

wants to merge 1 commit into from

Conversation

timotk
Copy link

@timotk timotk commented Nov 1, 2020

Pull Request Check List

Resolves: #742
Related PR: #3083

  • Added tests for changed code.
  • Updated documentation for changed code.

I was experiencing HTTP redirect errors on poetry v1.14.0, even though 301 redirects are being handled properly. It appears I was getting a 308. I have added the 308 so that it will be caught and added a new test.

@ObserverOfTime You recently worked on this as well. Could you have a look and share your thoughts?

Copy link
Contributor

@ObserverOfTime ObserverOfTime left a comment

Choose a reason for hiding this comment

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

Might as well handle the entire 3xx class at this point but LGTM either way.

@@ -46,6 +46,18 @@ def test_uploader_properly_handles_301_redirects(http):
)


def test_uploader_properly_handles_308_redirects(http):
Copy link
Member

Choose a reason for hiding this comment

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

To avoid copy-pasting, let's parameterize this test instead.

@@ -272,7 +272,7 @@ def _upload_file(
)
)
bar.finish()
elif resp.status_code == 301:
elif resp.status_code in (301, 308):
Copy link
Member

Choose a reason for hiding this comment

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

Since we're dropping Python 2 support, let's take advantage of the enums in https://docs.python.org/3/library/http.html#http.HTTPStatus instead of using the raw status codes.

@neersighted neersighted self-assigned this Nov 14, 2021
@Secrus
Copy link
Member

Secrus commented May 23, 2023

Changes made in this PR were added to the code base. Closing.

@Secrus Secrus closed this May 23, 2023
Copy link

github-actions bot commented Mar 3, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload to TestPyPI silently failed.
4 participants