-
Notifications
You must be signed in to change notification settings - Fork 110
Closed as not planned
Closed as not planned
Copy link
Description
python-bugzilla/bugzilla/base.py
Lines 137 to 160 in a7c3240
@staticmethod | |
def fix_url(url, force_rest=False): | |
""" | |
Turn passed url into a bugzilla XMLRPC web url | |
:param force_rest: If True, generate a REST API url | |
""" | |
(scheme, netloc, path, | |
params, query, fragment) = urllib.parse.urlparse(url) | |
if not scheme: | |
scheme = 'https' | |
if path and not netloc: | |
netloc = path.split("/", 1)[0] | |
path = "/".join(path.split("/")[1:]) or None | |
if not path: | |
path = 'xmlrpc.cgi' | |
if force_rest: | |
path = "rest/" | |
newurl = urllib.parse.urlunparse( | |
(scheme, netloc, path, params, query, fragment)) | |
return newurl |
When I try to initialize Bugzilla with GCC Bugzilla url "gcc.gnu.org/bugzilla", it fails to initialize Bugzilla since it fails to extend the url to an XMLRPC url, but it works fine with "gcc.gnu.org/bugzilla/xmlrpc.cgi". Probably useful to enhance fix_url() to solve this type of urls.
Traceback (most recent call last):
File "/Users/yizhengxie/Desktop/untitled_folder/test.py", line 19, in <module>
bzapi = bugzilla.Bugzilla(URL_gcc)
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/base.py", line 251, in __init__
self.connect(url)
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/base.py", line 526, in connect
version = self._backend.bugzilla_version()["version"]
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 146, in bugzilla_version
return self._xmlrpc_proxy.Bugzilla.version()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1109, in __call__
return self.__send(self.__name, args)
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 125, in _ServerProxy__request
ret = ServerProxy._ServerProxy__request(
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 1450, in __request
response = self.__transport.request(
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 100, in request
return self.__request_helper(url, request_body)
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 63, in __request_helper
raise e
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 47, in __request_helper
return self.parse_response(response)
File "/Users/yizhengxie/Desktop/untitled_folder/bugzilla/_backendxmlrpc.py", line 77, in parse_response
parser.feed(msg)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/xmlrpc/client.py", line 438, in feed
self._parser.Parse(data, 0)
bugzilla.exceptions.BugzillaError: mismatched tag: line 70, column 4
The URL may not be an XMLRPC URL: https://gcc.gnu.org/bugzilla
Metadata
Metadata
Assignees
Labels
No labels