11# This work is licensed under the GNU GPLv2 or later.
22# See the COPYING file in the top-level directory.
33
4+ import configparser
5+ import http .cookiejar
46import os
57from logging import getLogger
8+ import urllib .parse
69
7- from ._compatimports import (ConfigParser , LoadError ,
8- MozillaCookieJar , urlparse )
910from .exceptions import BugzillaError
1011from ._util import listify
1112
1516def _parse_hostname (url ):
1617 # If http://example.com is passed, netloc=example.com path=""
1718 # If just example.com is passed, netloc="" path=example.com
18- parsedbits = urlparse (url )
19+ parsedbits = urllib . parse . urlparse (url )
1920 return parsedbits .netloc or parsedbits .path
2021
2122
@@ -60,7 +61,7 @@ def set_configpaths(self, configpaths):
6061 configpaths = [os .path .expanduser (p ) for p in
6162 listify (configpaths or [])]
6263
63- cfg = ConfigParser ()
64+ cfg = configparser . ConfigParser ()
6465 read_files = cfg .read (configpaths )
6566 if read_files :
6667 log .info ("Found bugzillarc files: %s" , read_files )
@@ -118,7 +119,7 @@ def save_api_key(self, url, api_key):
118119
119120 config_filename = configpaths [- 1 ]
120121 section = _parse_hostname (url )
121- cfg = ConfigParser ()
122+ cfg = configparser . ConfigParser ()
122123 cfg .read (config_filename )
123124
124125 if section not in cfg .sections ():
@@ -146,7 +147,7 @@ def __init__(self):
146147 self ._cfg = None
147148
148149 def _get_domain (self , url ):
149- domain = urlparse (url )[1 ]
150+ domain = urllib . parse . urlparse (url )[1 ]
150151 if domain and domain not in self ._cfg .sections ():
151152 self ._cfg .add_section (domain )
152153 return domain
@@ -178,7 +179,7 @@ def get_filename(self):
178179
179180 def set_filename (self , filename ):
180181 log .debug ("Using tokenfile=%s" , filename )
181- cfg = ConfigParser ()
182+ cfg = configparser . ConfigParser ()
182183 if filename :
183184 cfg .read (filename )
184185 self ._filename = filename
@@ -194,15 +195,15 @@ def __init__(self):
194195 self ._cookiejar = None
195196
196197 def _build_cookiejar (self , cookiefile ):
197- cj = MozillaCookieJar (cookiefile )
198+ cj = http . cookiejar . MozillaCookieJar (cookiefile )
198199 if (cookiefile is None or
199200 not os .path .exists (cookiefile )):
200201 return cj
201202
202203 try :
203204 cj .load ()
204205 return cj
205- except LoadError :
206+ except http . cookiejar . LoadError :
206207 msg = "cookiefile=%s not in Mozilla format" % cookiefile
207208 raise BugzillaError (msg ) from None
208209
0 commit comments