how to resolve the authentication issue while getting data with python request ?
I am making an authentication request with Python's requests package, to fetch Test Plan details and further processing, from MY_PROJECT.
Right in the beginning of it I am facing the authorization issue, despite getting a 200 status. Details : 1. URL = https://MY_PROJECT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/
2. response = requests.get(URL, auth = (MY_UN, MY_PW), verify=False) 3. I have verified the browser to have Java - Auto Enabled 4. Experimented with passing header, but to no avail :5. Experimented with Proxies as well, and it seems to be fine on that front._headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/'
'537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
For the above request, I am getting notably these texts : 1. <Javascript is either disabled or not available in your Browser> ... 2. <net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired")> Requesting if there is someway in which I can solve this issue ? pasting a sample output for reference Output - <!DOCTYPE html><body class="claro"><noscript><div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div></noscript> <div id="net-jazz-ajax-InitialLoadMessage">Loading...</div> <div id="net-jazz-ajax-WorkbenchRoot"></div> . . .<script type="text/javascript"> /* <![CDATA[ */ require(["dojo/ready", "dojo/parser", "dijit/registry", "dijit/Dialog"], function(ready, parser, registry){ ready(function(){ net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired"); }); }); /* ]]> */ /script> </body> </html>
<200>
Process finished with exit code 0
One answer
Basically, you are not authenticated and you need a session.
There are different authentication schemas dependent on how your server is configured. Please see: https://rsjazz.wordpress.com/2021/10/15/elm-authentication/ which is based on https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication .
Comments
Thank you Ralph for the response ! I 'll check out that link.
Hi Ralph, I followed the NativeClientAuthentication link and the authentication steps defined there. I see that my schema is " FORM Challenge", as I get the GET status of < 200 > for the initial request.
However, after sequentially proceeding to Analysis of POST Status, I get :
1. Status = 200
2. header [
X-com-ibm-team-repository-web-auth-msg ]
= authrequired .
Which suggests that the Authentication is successful; and I replayed my initial GET URL request many times (as suggested in the NCA link)
But Still, I am getting the Output as described in my original Post.
Requesting if you could help me out here.
With Thanks.
PS : I also did my Approach as outlined by the Blog wrt python functions and such.
The header
[
X-com-ibm-team-repository-web-auth-msg ]
= authrequired
My code works, look what it does and take it or leave it. I have used it for a long time now. I am pretty sure I know how this works.
I will not continue discussing this here. To be sure, you can also use Firefox, install RESTClient. Open the target application in the browser and authenticate. Then GET your link. If that works you know you did your authentication wrong.