openx / OX3-Python-API-Client

Helper class for accessing the OX3 API - Requires https://github.com/simplegeo/python-oauth2
Other
8 stars 17 forks source link

KeyError: 'oauth_verifier' #27

Closed joyofdata closed 7 years ago

joyofdata commented 7 years ago

I get an error attempting to logon() with this package. Any ideas what might be the problem?


1st attempt:

import imp
ox3apiclient = imp.load_source(
    'ox3apiclient', 
    '/home/raffael/company/repos/OX3-Python-API-Client/ox3apiclient/__init__.py'
)

ox = ox3apiclient.Client(
    email="nn@company.de",
    password="password",
    domain="company-ui3.openxenterprise.com",
    realm="company",
    consumer_key='cb...97',
    consumer_secret='72...2c')

ox.logon("nn@company.de","password")

Error:

KeyError                                  Traceback (most recent call last)
<ipython-input-25-34f91eace7b5> in <module>()
----> 1 ox.logon("nn@company.de","password")

/home/raffael/company/repos/OX3-Python-API-Client/ox3apiclient/__init__.pyc in logon(self, email, password)
    258         """
    259         self.fetch_request_token()
--> 260         self.authorize_token(email=email, password=password)
    261         self.fetch_access_token()
    262         self.validate_session()

/home/raffael/company/repos/OX3-Python-API-Client/ox3apiclient/__init__.pyc in authorize_token(self, email, password)
    196 
    197         # set token verifier
--> 198         self._token['verifier'] = parse_qs(response.content)['oauth_verifier'][0]
    199 
    200     def fetch_access_token(self):

KeyError: 'oauth_verifier'

2nd attempt

Inhalt von /home/raffael/company/repos/OX3-Python-API-Client/.ox3rc:

[ox3apiclient]
envs=prod

[prod]
email: nn@company.de
password: password
domain: company-ui3.openxenterprise.com
realm: company
consumer_key: cb...97
consumer_secret: 72...2c

import ox3apiclient
import logging

ox = ox3apiclient.client_from_file(
    file_path="/home/raffael/company/repos/OX3-Python-API-Client/.ox3rc",
    env="prod"
).logon()

Error:

KeyError                                  Traceback (most recent call last)
<ipython-input-29-5bf774e379bc> in <module>()
      4 ox = ox3apiclient.client_from_file(
      5     file_path="/home/raffael/company/repos/OX3-Python-API-Client/.ox3rc",
----> 6     env="prod"
      7 ).logon()

/home/raffael/company/repos/OX3-Python-API-Client/ox3apiclient/__init__.pyc in logon(self, email, password)
    258         """
    259         self.fetch_request_token()
--> 260         self.authorize_token(email=email, password=password)
    261         self.fetch_access_token()
    262         self.validate_session()

/home/raffael/company/repos/OX3-Python-API-Client/ox3apiclient/__init__.pyc in authorize_token(self, email, password)
    196 
    197         # set token verifier
--> 198         self._token['verifier'] = parse_qs(response.content)['oauth_verifier'][0]
    199 
    200     def fetch_access_token(self):

KeyError: 'oauth_verifier'
haohany commented 7 years ago

I had the same error with a wrong password. Check your username/password.

TimWhalen commented 7 years ago

You can verify you're using the correct username/password by logging onto company-ui3.openxenterprise.com in a browser. You may have an expired/locked out account, etc.

marcsantiago commented 7 years ago

I've had dealing with openx customer support. It has to do with that particular branch your using. You'll have better luck if you use the master branch, which has had some updates and clean up done to it.

On Tue, Oct 18, 2016, 4:13 PM TimWhalen notifications@github.com wrote:

You can verify you're using the correct username/password by logging onto company-ui3.openxenterprise.com in a browser. You may have an expired/locked out account, etc.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openx/OX3-Python-API-Client/issues/27#issuecomment-254625480, or mute the thread https://github.com/notifications/unsubscribe-auth/AHmd3NUvptAvsRoS-_-BqqG-1f7EYxliks5q1ShqgaJpZM4KZjDt .

joyofdata commented 7 years ago

We are using two accounts - and I used the wrong one's credentials - so @haohany was correct.

@marcsantiago - thanks for your suggestion - though both branches seem to work.