Skip to content

Commit

Permalink
Log all upload responses with --verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrutledge committed Jan 17, 2022
1 parent ce87465 commit 2cf7138
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 7 additions & 0 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ def upload(upload_settings: settings.Settings, dists: List[str]) -> None:

resp = repository.upload(package)

if upload_settings.verbose:
logger.info(
f"Received {resp.status_code} response from {resp.url}: {resp.reason}"
)
if resp.text:
logger.info(f"Response text:\n{resp.text}")

# Bug 92. If we get a redirect we should abort because something seems
# funky. The behaviour is not well defined and redirects being issued
# by PyPI should never happen in reality. This should catch malicious
Expand Down
3 changes: 0 additions & 3 deletions twine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ def check_status_code(response: requests.Response, verbose: bool) -> None:
"Retry with the --verbose option for more details."
)

if response.text:
logger.info("Content received from server:\n{}".format(response.text))

raise err


Expand Down

0 comments on commit 2cf7138

Please sign in to comment.