Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Connect to DOORS - DOORS Web Access via Python

All,

I'm very close but just a little out of my element. Have been able to login to RQM via python but cannot hit DOORS/DOORS Web Access.

I'm using the rauth library with Python 2.6, but it seems that the responses that it expects don't follow the examples.

I've set up an OSLC local key on the DOORS side. So here's some sample code:

CODE BEGIN
class DWAClient(object):
    def __init__(self):

        #setup oAUTH client
        print "Starting DWA Client"
        DWA = OAuth1Service(
            name='RQMScripts',
            consumer_secret='doors',
            consumer_key='123456',
            request_token_url='http://myserver:8080/dwa/oauth-request-token',
            access_token_url='http://myserver:8080/dwa/oauth-access-token',
            authorize_url='http://myserver:8080/dwa/oauth-authorize-token',
            base_url='http://myserver:8080/dwa/'
            )
        self.request_token, self.request_token_secret = DWA.get_request_token(method='GET')
        #this works
        print "REQUEST TOKEN:"
        print self.request_token
        print "REQUEST TOKEN SECRET:"
        print self.request_token_secret

        authorize_url = DWA.get_authorize_url(self.request_token)

        print "LOGGING INTO DWA:"
        print authorize_url

        j_username = raw_input('Enter DOORS Username:')
        j_password = getpass.getpass('Enter DOORS Password:')
       
        self.session = DWA.get_auth_session(self.request_token,
                                   self.request_token_secret,
                                   method='POST',
                                   params={'j_username': j_username,
                                         'j_password': j_password,
                                         'authorize' : 'true'},
                                    headers={'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8'})

CODE END

I've fooled around with the httplib2 lib, and have even been able to get a verifier, but I'm pretty sure I don't want to go down that path unless I have to. This rauth library seems very nice and suited for all sorts of use cases but I can't make it work here. Does anyone have any clues, or any tips I can use to troubleshoot this? It'd be much appreciated!

0 votes



4 answers

Permanent link
Forgot to provide what the error message actually is:

ERROR BEGIN
KeyError: 'Decoder failed to handle oauth_token with data as returned by provider. A different decoder may be needed. Provider returned: <html><head><title>IBM Rational DOORS Web Access</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - Request token has not been authorized.</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Request token has not been authorized.</u></p><p><b>description</b> <u>This request requires HTTP authentication (Request token has not been authorized.).</u></p></body></html>'

ERROR END

There are multiple things going on--rauth doesn't understand the returned response and the token isn't actually being authorized.

The function:
DWA.get_raw_access_token(self.request_token, self.request_token_secret, method='POST', data={'oauth_verifier': verifier})

works (when I manually get the oauth_verifier)...but I am not sure how to put everything together. I'm very, very close here.

0 votes


Permanent link
I got to the rm catalog! There was no "trick" to doing so except for arduous trial and error, though I did find that using the requests-oauthlib library and the example at http://requests-oauthlib.readthedocs.org/en/latest/oauth1_workflow.html using the helper got me through this.

I'm sure I'm doing something wrong, but I found the only way to get a verifier was to sign in to DWA twice via code.

0 votes


Permanent link

Hi Kevin,

I have same need as yours but I stopped even short of your point. Could you share python code to achive that?

A thousand thanks.

0 votes


Permanent link

My python code above is old. Python 2.


I recommend signing in to JTS via Python and then switching to DNG from there. It should use the same cookie and you should be able to get in.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,942
× 7,501

Question asked: May 19 '14, 10:13 a.m.

Question was seen: 10,432 times

Last updated: Jul 17 '23, 1:33 p.m.

Confirmation Cancel Confirm