POVR2
POVR2

Reputation: 65

Why is the rtcclient `getWorkitem()` for IBM RTC HTTP GET request returning incorrect response?

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:

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:

enter image description here

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?

Upvotes: 2

Views: 384

Answers (1)

VonC
VonC

Reputation: 1328192

Check first if this was working with 0.6.0 (depending on your RTC version 6.x?; 7.x).

dixudx/rtcclient issue 136 mentions:

v0.7.0 has introduced a change on authentication, refer to #133 for details (and issue 112), which may be not compatible with older Rational Team Concert. From your issue, it seems to be true. Sorry for this.

My suggestion is just sticking with older rtcclient version, such as pip install rtcclient==0.6.0.

Upvotes: 0

Related Questions