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

Add helpful error message for incorrect PyPI URL #509

Merged
merged 14 commits into from
Oct 30, 2019
Merged
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions twine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ def check_status_code(response, verbose):
"(or https://test.pypi.org/legacy/) to upload your packages "
"instead. These are the default URLs for Twine now. More at "
"https://packaging.python.org/guides/migrating-to-pypi-org/ ")
if (response.status_code == 405 and
response.url.startswith(("https://pypi.org",
"https://test.pypi.org"))):
print("You probably want one of these two URLs: {} or {}. Check {} for"
" more information.".format(
"https://pypi.org/legacy/",
"https://test.pypi.org/legacy/",
"https://warehouse.readthedocs.io/api-reference/legacy/"
"#upload-api"))
try:
response.raise_for_status()
except HTTPError as err:
Expand Down