Skip to content

Commit

Permalink
Use requests_toolbelt to log request/response
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrutledge committed Jan 19, 2022
1 parent 2cf7138 commit b458254
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import Dict, List, cast

import requests
from requests_toolbelt.utils import dump

from twine import commands
from twine import exceptions
Expand Down Expand Up @@ -141,11 +142,7 @@ 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}")
logger.info(dump.dump_all(resp).decode("utf-8"))

# Bug 92. If we get a redirect we should abort because something seems
# funky. The behaviour is not well defined and redirects being issued
Expand Down

0 comments on commit b458254

Please sign in to comment.