summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/dogtag.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-09-14 12:52:29 +0200
committerJan Cholasta <jcholast@redhat.com>2015-10-07 10:27:20 +0200
commit70b37a956c0b7dad52bf14fdb5fed421c01c8f77 (patch)
tree76768609fdbca12ccc93b092e14c4fc4ae06459a /ipaserver/plugins/dogtag.py
parent7f1204a42c0fd13602768e24da7af8814cbf97d2 (diff)
downloadfreeipa-70b37a956c0b7dad52bf14fdb5fed421c01c8f77.tar.gz
freeipa-70b37a956c0b7dad52bf14fdb5fed421c01c8f77.tar.xz
freeipa-70b37a956c0b7dad52bf14fdb5fed421c01c8f77.zip
Use six.moves.urllib instead of urllib/urllib2/urlparse
In Python 3, these modules are reorganized. Reviewed-By: David Kupka <dkupka@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaserver/plugins/dogtag.py')
-rw-r--r--ipaserver/plugins/dogtag.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py
index 1a4bf2eab..6758b9077 100644
--- a/ipaserver/plugins/dogtag.py
+++ b/ipaserver/plugins/dogtag.py
@@ -244,13 +244,13 @@ from lxml import etree
import os
import tempfile
import time
-import urllib2
import pki
from pki.client import PKIConnection
import pki.crypto as cryptoutil
from pki.kra import KRAClient
import six
+from six.moves import urllib
from ipalib import Backend
from ipapython.dn import DN
@@ -1843,21 +1843,21 @@ class ra(rabase.rabase):
url = 'http://%s/ca/rest/certs/search?size=%d' % (ipautil.format_netloc(self.ca_host, ipapython.dogtag.configured_constants().UNSECURE_PORT), options.get('sizelimit', 100))
- opener = urllib2.build_opener()
+ opener = urllib.request.build_opener()
opener.addheaders = [('Accept-Encoding', 'gzip, deflate'),
('User-Agent', 'IPA')]
- req = urllib2.Request(url=url, data=payload, headers={'Content-Type': 'application/xml'})
+ req = urllib.request.Request(url=url, data=payload, headers={'Content-Type': 'application/xml'})
try:
response = opener.open(req)
- except urllib2.HTTPError, e:
+ except urllib.error.HTTPError as e:
self.debug('HTTP Response code: %d' % e.getcode())
if e.getcode() == 501:
self.raise_certificate_operation_error('find',
detail=_('find not supported on CAs upgraded from 9 to 10'))
self.raise_certificate_operation_error('find',
detail=e.msg)
- except urllib2.URLError, e:
+ except urllib.error.URLError as e:
self.raise_certificate_operation_error('find',
detail=e.reason)
@@ -1866,7 +1866,7 @@ class ra(rabase.rabase):
parser = etree.XMLParser()
try:
doc = etree.fromstring(data[0], parser)
- except etree.XMLSyntaxError, e:
+ except etree.XMLSyntaxError as e:
self.raise_certificate_operation_error('find',
detail=e.msg)