Giter Club home page Giter Club logo

Comments (10)

tikismoke avatar tikismoke commented on September 26, 2024 1

Your right but it's you exemple on the readme page :) I'll propose a pull request for this on README.

if i pass token.access_token i get this error:

Traceback (most recent call last):
  File "xee_exemple.py", line 21, in <module>
    user = xee.get_user(token.access_token)
AttributeError: 'tuple' object has no attribute 'access_token'

from xee-sdk-python.

tikismoke avatar tikismoke commented on September 26, 2024 1

Nice ;) this works.

Going to update the README a second time ;)

from xee-sdk-python.

quentin7b avatar quentin7b commented on September 26, 2024

Yeah,

In fact when you call get_token_from_*(), it returns a tuple with the access_token and the refresh_token.

So when you call get_cars(), you have to pass token.access_token ?

Or I misunderstood the error ?

from xee-sdk-python.

tikismoke avatar tikismoke commented on September 26, 2024

Still the tuple object attribute to correct in last comment.
Still trying to find a solution for @domogik ;)

from xee-sdk-python.

quentin7b avatar quentin7b commented on September 26, 2024

Damn, I've read too fast.
Can you past the full code from token fetching to get_cars call ?

from xee-sdk-python.

tikismoke avatar tikismoke commented on September 26, 2024
#cat xee_exemple.py
from xee import Xee

xee = Xee(client_id="9QESM4Tqh5xxxx2uJhj1NP",
        client_secret="3brSxxxxxxxxxjaG",
        redirect_uri="http://localhost")

login_url = xee.get_authentication_url()

print("Go to %s allow the app and copy your oauth_verifier" %login_url)
authorization_code = raw_input('Please enter your authorization_code: ')

token = xee.get_token_from_code(authorization_code)
print token
tokenacess ="4551ecfa29f1xxxxxxxxxxxxb7985ef8929b"
user = xee.get_user(tokenacess)
print user
car = xee.get_cars(token.access_token)
print car

In this exemple i get the user info but not the cars one with error:

AttributeError: 'tuple' object has no attribute 'access_token'

I'm using python 2.7 maybe it comes from here too.

from xee-sdk-python.

tikismoke avatar tikismoke commented on September 26, 2024

Token print looks like this:

(Token(access_token=u'8598fad36379dffdxxxxxxxxxxxxcf44b73266c22c69bf3c', refresh_token=u'29ed2323xxxxxxxxxxxxxxxxx1719c2fd19a82214d3', expires_in=172800, expires_at=1473097041), None)

from xee-sdk-python.

tikismoke avatar tikismoke commented on September 26, 2024

Found something.....
user = xee.get_user(token[0].access_token)

from xee-sdk-python.

quentin7b avatar quentin7b commented on September 26, 2024

Ho fine.

As (almost) every call to the SDK it returns a:

response, error

So may be try with this:

from xee import Xee

xee = Xee(client_id="9QESM4Tqh5xxxx2uJhj1NP",
        client_secret="3brSxxxxxxxxxjaG",
        redirect_uri="http://localhost")

login_url = xee.get_authentication_url()

print("Go to %s allow the app and copy your oauth_verifier" %login_url)
authorization_code = raw_input('Please enter your authorization_code: ')

token, error = xee.get_token_from_code(authorization_code)
print token
tokenacess ="4551ecfa29f1xxxxxxxxxxxxb7985ef8929b"
user, error = xee.get_user(tokenacess)
print user
car, error = xee.get_cars(token.access_token)
print car

from xee-sdk-python.

quentin7b avatar quentin7b commented on September 26, 2024

Do you want to do this or ?

from xee-sdk-python.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.