diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-22 18:13:51 +0100 |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-22 18:13:51 +0100 |
| commit | a9d129418d7569a12e225e130711524a89868eca (patch) | |
| tree | f95478d1bc6ad320d0b165341b174c5799bd50f0 /config.py | |
| parent | 13766f65fc959da18e5d775ceb7a25ed71ed401e (diff) | |
| download | python-setuptools-git-a9d129418d7569a12e225e130711524a89868eca.tar.gz | |
Fix TypeError on "setup.py upload --show-response".
Diffstat (limited to 'config.py')
| -rw-r--r-- | config.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -3,6 +3,7 @@ Provides the PyPIRCCommand class, the base class for the command classes that uses .pypirc in the distutils.command package. """ +import cgi import os from configparser import ConfigParser @@ -101,6 +102,12 @@ class PyPIRCCommand(Command): return {} + def _read_pypi_response(self, response): + """Read and decode a PyPI HTTP response.""" + content_type = response.getheader('content-type', 'text/plain') + encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii') + return response.read().decode(encoding) + def initialize_options(self): """Initialize options.""" self.repository = None |
