Comments (10)
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.
Nice ;) this works.
Going to update the README a second time ;)
from xee-sdk-python.
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.
Still the tuple object attribute to correct in last comment.
Still trying to find a solution for @domogik ;)
from xee-sdk-python.
Damn, I've read too fast.
Can you past the full code from token fetching to get_cars
call ?
from xee-sdk-python.
#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.
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.
Found something.....
user = xee.get_user(token[0].access_token)
from xee-sdk-python.
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.
Do you want to do this or ?
from xee-sdk-python.
Related Issues (14)
- [User] Some exception on values returned by the api HOT 4
- datetime & tzinfo HOT 12
- [User] Licence for driver but License in API HOT 1
- Add a test_token() method (Enchancement)
- [Doc] Contributing : Add contributing guidelines
- [Doc] Examples : Add more examples in the README
- [MISC] Tests : Add some tests HOT 1
- [Misc] Python : 2.7 backward compatibility HOT 1
- [Feat] Trip : Add trip statistics HOT 1
- [Feat] API : Add Xee compat API
- V4 Api HOT 1
- [Install] 2 folders when update, add update target ? HOT 2
- Exception in master Branch HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xee-sdk-python.