mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Fix TypeError on "setup.py upload --show-response".
This commit is contained in:
parent
f20ea13996
commit
335a5128e5
5 changed files with 28 additions and 6 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue