I am trying to use the rtcclient Python package to authenticate and retrieve work items from my IBM RTC board. Specifically my goal is to run this command without errors:
myclient.getWorkitem("202007")
where 202007 is the id of an 'epic' ticket.
Whenever I try to run my program, I end up facing an XML parsing error, where rtcclient makes a GET request to a URL and expects to receive an XML data, but instead only shows HTML in the resp.content.
For example, if I start my Python shell and run these commands:
>>> from rtcclient.utils import setup_basic_logging
>>> from rtcclient import RTCClient
>>> setup_basic_logging()
>>> myclient = RTCClient("https://rtcus1.ta.company.com/ccm", "myUsername", "myPassword", ends_with_jazz=False)
2022-02-22 16:55:55,605 DEBUG client.RTCClient: Get response from https://rtcus1.ta.company.com/ccm/authenticated/identity
2022-02-22 16:55:55,612 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): rtcus1.ta.company.com:443
2022-02-22 16:55:56,264 DEBUG urllib3.connectionpool: https://rtcus1.ta.company.com:443 "GET /ccm/authenticated/identity HTTP/1.1" 302 0
2022-02-22 16:55:56,288 ERROR client.RTCClient: Failed GET request at <https://rtcus1.ta.company.com/ccm/authenticated/identity> with response: b''
2022-02-22 16:55:56,290 DEBUG client.RTCClient: Get response from https://rtcus1.ta.company.com/ccm/authenticated/identity
2022-02-22 16:55:56,292 DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): rtcus1.ta.company.com:443
2022-02-22 16:55:56,875 DEBUG urllib3.connectionpool: https://rtcus1.ta.company.com:443 "GET /ccm/authenticated/identity HTTP/1.1" 302 0
2022-02-22 16:55:56,886 ERROR client.RTCClient: Failed GET request at <https://rtcus1.ta.company.com/ccm/authenticated/identity> with response: b''
>>> myclient.getWorkitem("202007")
After executing getWorkItem, it will run this code around line 909 of the rtcclient/rtcclient/client.py file
resp = self.get(req_url, verify=False, proxies=self.proxies, headerss=self.headers)
where:
req_url="https://rtcus1.ta.company.com/ccm/oslc/workitems/202007"proxies = Noneheaders = {'Content-Type': 'text/xml', 'Cookie': 'WASReqURL=https:///ccm/authenticated/identity; Path=/; Secure; HttpOnly; WASReqURL=https:///ccm/authenticated/identity; Path=/; Secure; HttpOnly', 'Accept': 'text/xml'}
After the request completes, the value of resp.content is a long HTML string which contains 'Loading...' and '>Javascript is either disabled or not available in your Browser':
b'<!DOCTYPE html>\n<!--\n \n-->\n\n<html >\n<head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n<meta http-equiv="X-UA-Compatible" content="IE=10">\n<title></title>\n\n<lin...... ody>\n</html>\n'
But if I go to the req_url in my browser where I have logged in with the same credentials, I see valid XML data; this is the data I need rtcclient to fetch:
But instead, it fetches that HTML data which messes up the program and prevents me from fetching work items. Does anyone have a solution or know how I could make a request to my RTC XML URL in postman to fetch the XML data and verify it is possible to do so?
