Use six.moves.http_client instead of httplib

The module was renamed in Python 3.

Reviewed-By: David Kupka <dkupka@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Viktorin 2015-09-14 14:03:58 +02:00 committed by Jan Cholasta
parent 187efdfe42
commit 026b1b5307
4 changed files with 30 additions and 5 deletions

View File

@ -19,7 +19,6 @@
import collections
import os
import httplib
import xml.dom.minidom
import nss.nss as nss
@ -34,6 +33,13 @@ from ipapython import nsslib, ipautil
from ipaplatform.paths import paths
from ipapython.ipa_log_manager import *
# Python 3 rename. The package is available in "six.moves.http_client", but
# pylint cannot handle classes from that alias
try:
import httplib
except ImportError:
import http.client as httplib
if six.PY3:
unicode = str

View File

@ -21,7 +21,6 @@
from __future__ import print_function
import sys
import httplib
import getpass
import socket
from ipapython.ipa_log_manager import *
@ -31,6 +30,14 @@ import nss.io as io
import nss.nss as nss
import nss.ssl as ssl
import nss.error as error
# Python 3 rename. The package is available in "six.moves.http_client", but
# pylint cannot handle classes from that alias
try:
import httplib
except ImportError:
import http.client as httplib
from ipaplatform.paths import paths
# NSS database currently open
@ -295,6 +302,7 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
self.close()
raise e
class NSSHTTPS(httplib.HTTP):
# We would like to use HTTP 1.1 not the older HTTP 1.0 but xmlrpc.client
# and httplib do not play well together. httplib when the protocol

View File

@ -25,7 +25,6 @@ import array
import base64
import binascii
import dbus
import httplib
import ldap
import os
import pwd
@ -69,6 +68,13 @@ from ipaserver.install.dogtaginstance import DogtagInstance
from ipaserver.install.dogtaginstance import PKI_USER, DEFAULT_DSPORT
from ipaserver.plugins import ldap2
# Python 3 rename. The package is available in "six.moves.http_client", but
# pylint cannot handle classes from that alias
try:
import httplib
except ImportError:
import http.client as httplib
# When IPA is installed with DNS support, this CNAME should hold all IPA
# replicas with CA configured

View File

@ -20,12 +20,17 @@
Base class for HTTP request tests
"""
import httplib
from six.moves import urllib
from ipalib import api
# Python 3 rename. The package is available in "six.moves.http_client", but
# pylint cannot handle classes from that alias
try:
import httplib
except ImportError:
import http.client as httplib
class Unauthorized_HTTP_test(object):
"""
Base class for simple HTTP request tests executed against URI