'TwitterAccessToken' object has no attribute 'redirect_uri'
Closed this issue · 19 comments
Why is it even required by oauth_tokens when calling: User.remote.fetch ??? Where should I define it?
try to update
pip install django-oauth-tokens --upgrade
there is this attribute in the last version
This also pushes my django to upgrade to the latest version ;/
2016-02-20 2:06 GMT+01:00 Boris Shifrin notifications@github.com:
try to update
pip install django-oauth-tokens --upgrade
there is this attribute in the last version
—
Reply to this email directly or view it on GitHub
#12 (comment)
.
ok try this
pip install django-oauth-tokens==0.6.3
Same error
Try to install this version and after decrease version of Django to required by your project
Or point this version in your requirements.txt and install everything with pip
That's exactly what I did. Unfortunately either way it is django-oauth-tokens==0.6.3
I see this attribute in source code https://github.com/ramusus/django-oauth-tokens/blob/master/oauth_tokens/providers/twitter.py#L44
Could you provide full error traceback?
Got inside /usr/local/.../oauth_tokens/providers/twitter.py
I am missing that line. After pip freeze: django-oauth-tokens==0.6.3
I installed via: git+https://github.com/ramusus/django-twitter-api#egg=django-auth-tokens
but now I get another error: 'NoneType' object has no attribute 'inactivate'.
I'm debugging it, but I think that django-twitter-api needs some improvements.
There's the whole log:
[Feb 20 20:01:40] [ERROR] Internal Server Error: /complete/twitter/
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/utils.py", line 51, in wrapper
return func(request, backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/views.py", line 28, in complete
redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/actions.py", line 43, in do_complete
user = backend.complete(user=user, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py", line 41, in complete
return self.auth_complete(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/utils.py", line 229, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/backends/oauth.py", line 182, in auth_complete
return self.do_auth(access_token, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/utils.py", line 229, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/backends/oauth.py", line 193, in do_auth
return self.strategy.authenticate(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/strategies/django_strategy.py", line 96, in authenticate
return authenticate(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py", line 74, in authenticate
user = backend.authenticate(**credentials)
File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py", line 82, in authenticate
return self.pipeline(pipeline, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py", line 85, in pipeline
out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/backends/base.py", line 112, in run_pipeline
result = func(*args, **out) or {}
File "/usr/local/lib/python2.7/dist-packages/social/pipeline/partial.py", line 15, in wrapper
*args, **kwargs) or {}
File "/app/accounts/pipeline.py", line 44, in save_profile
tuser = User.remote.fetch(response['id'])
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 104, in fetch
result = self.get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 117, in get
response = self.api_call(method, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 98, in api_call
return api_call(method, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/api.py", line 87, in api_call
return api.call(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth_tokens/api.py", line 79, in call
token = self.get_token(tag=self.token_tag)
File "/usr/local/lib/python2.7/dist-packages/oauth_tokens/api.py", line 215, in get_token
self.update_tokens()
File "/usr/local/lib/python2.7/dist-packages/oauth_tokens/api.py", line 160, in update_tokens
AccessToken.objects.fetch(provider=self.provider)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 145, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth_tokens/models.py", line 162, in fetch
user.inactivate(e)
AttributeError: 'NoneType' object has no attribute 'inactivate'
But the logs say it's my fault:
LOCK: locking with key update_tokens_for_twitter
[Feb 20 20:56:29] [ERROR] Error 'Token request failed with code 400, response was '{"errors":[{"code":215,"message":"Bad Authentication data."}]}'.' while getting new token for provider twitter and user None
LOCK: releasing lock update_tokens_for_twitter
Why are you getting oauth_verifier by BeautifulSoup? It isn't working right now, because twitter changed DOM.
Apps in twitter are redirecting you to given URL in apps.twitter.com and oauth_verifier is one of GET arguments
After fixtures to django-oauth-tokens m2m-history fails...
did you solve authentication problem with twitter ?
what problem with m2m_history ?
yes, I PR'd twitter problem solution.
About m2m_history:
[Feb 24 21:46:17] [ERROR] Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 158, in get
context = self.get_context_data(**kwargs)
File "/app/politikon/views.py", line 27, in get_context_data
tuser.fetch_followers(all=True)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 509, in fetch_followers
return User.remote.fetch_followers_for_user(user=self, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 228, in fetch_followers_for_user
print(user.followers.all())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 228, in all
return self.get_queryset()
File "/usr/local/lib/python2.7/dist-packages/m2m_history/descriptors.py", line 78, in get_queryset
qs = self.get_queryset_through().filter(time_to=None)
File "/usr/local/lib/python2.7/dist-packages/m2m_history/descriptors.py", line 73, in get_queryset_through
self.source_field_name: self._fk_val,
AttributeError: 'ManyToManyHistoryThroughManager' object has no attribute '_fk_val'
I fix'd it, an PR'd. Check
https://github.com/ramusus/django-oauth-tokens and
https://github.com/ramusus/django-m2m-history
Now I get this:
[Feb 24 23:58:18] [ERROR] Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 158, in get
context = self.get_context_data(**kwargs)
File "/app/politikon/views.py", line 27, in get_context_data
tuser.fetch_followers(all=True)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 509, in fetch_followers
return User.remote.fetch_followers_for_user(user=self, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/twitter_api/models.py", line 228, in fetch_followers_for_user
print(user.followers.all())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 228, in all
return self.get_queryset()
File "/usr/local/lib/python2.7/dist-packages/m2m_history/descriptors.py", line 80, in get_queryset
return self._prepare_queryset(qs, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/m2m_history/descriptors.py", line 52, in _prepare_queryset
qs = super(ManyToManyHistoryThroughManager, self).get_query_set().using(
AttributeError: 'super' object has no attribute 'get_query_set'
hahahahahah, since django 1.8 there is no get_query_set. Wait a second
Now, we're back to errors in django-twitter-api:
IntegrityError at /
null value in column "profile_background_image_url" violates not-null constraint
the problem is also that pip install doesn't install the newest versions of your libraries.
updated version in pypi. thanks for support. are you experiencing any other troubles ? :) please, close this issue if not