gwu-libraries / social-feed-manager

"Old SFM" -- manage rules and streams from social data sources, starting with twitter.
MIT License
87 stars 20 forks source link

AttributeError: 'NoneType' object has no attribute 'user_timeline' #66

Closed a4blip closed 10 years ago

a4blip commented 10 years ago

i've completed instructions up until ./manage.py user_timeline. i've set up a server and a user.

This is the traceback:

(ENV)rachel@rachel-VirtualBox:~/social-feed-manager/sfm$ ./manage.py user_timeline --traceback user: UTAustin since: 1 Traceback (most recent call last): File "/home/rachel/social-feed-manager/ENV/local/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv self.execute(_args, _options.dict) File "/home/rachel/social-feed-manager/ENV/local/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute output = self.handle(_args, _options) File "/home/rachel/social-feed-manager/sfm/ui/management/commands/user_timeline.py", line 88, in handle timeline = api.user_timeline(screen_name=tweep.name, AttributeError: 'NoneType' object has no attribute 'user_timeline'

I'm not sure if I'm putting the wrong twitter default user name. Should it be the Twitter I'm trying to harvest or my own personal account? Should it include an @ sign? I'm using Django version 1.5.4.

Thanks,

Rachel

dchud commented 10 years ago

Hi Rachel. It sounds like you have the app up and running okay. The user_timeline command works on TwitterUsers, not "app" users, so rather than your system account, it's looking for the names of twitter accounts that you've added to the system.

Try this:

a4blip commented 10 years ago

I have two TwitterUsers. screen shot 2013-09-16 at 9 17 08 am

dchud commented 10 years ago

Ah, now I see that in your traceback, the UTAustin user is there correctly, sorry I missed that.

It looks like your API object hasn't properly instantiated. Did you follow all the steps for generating the API keys, and set the vars TWITTER_DEFAULT_USER, TWITTER_CONSUMER_KEY, and TWITTER_CONSUMER_SECRET in your local_settings.py ?

a4blip commented 10 years ago

I think that's where the problem is too. I did generate a key and secret which I entered, but what would be the default user? A Twitter user or my Django superuser name?

dchud commented 10 years ago

The TWITTER_DEFAULT_USER should be the exact same twitter user account you used to create the CONSUMER_KEY and CONSUMER_SECRET. It might be the same as what you used for your django superuser; that would be a coincidence. :)

This could be explained much better in the readme, I'll write a ticket for that.

a4blip commented 10 years ago

I keep getting the same error. I will keep playing around with it. Maybe because my tweets are protected it caused a glitch. I can make a new app with an open Twitter account.

dchud commented 10 years ago

Have you saved the account name as the value of the configuration variable TWITTER_DEFAULT_USER?

Don't start with a new twitter account... let's debug this just now, we can get it working.

Step by step: what's your twitter account name? And what's your django superuser account name?

(just the names... don't paste your keys or password into here! :)

a4blip commented 10 years ago

Yes I have. My twitter account name is frecklewars and my superuser account name is rachel. I added frecklewars as another superuser just now.

TWITTER_DEFAULT_USERNAME = 'frecklewars'

dchud commented 10 years ago

Okay, good. Now try this if you haven't yet:

I'm guessing that if you haven't already done this, the sfm app hasn't yet stored the credential tokens for your frecklewars twitter account yet. That could be why the api object isn't being created correctly in the management command.

a4blip commented 10 years ago

Yes that did it thank you!!!!

dchud commented 10 years ago

There we go! I'll make sure that's documented fully. Thanks!