Thursday, March 29, 2012

Re: Tweepy Not Displaying

On Wed, Mar 28, 2012 at 11:56 PM, coded kid <duffleboi911@gmail.com> wrote:
> Hi guys, I want to display user's timeline in my django app but it's
> not working. It only display a white blank page! I'm using Tweepy.
> Below are my codes:
>
> Views.py
>
> import tweepy
>
> def tweetstream(request):
>    consumer_key="XXXX"
>    consumer_secret="XXX"
>    access_token="XXX"
>    access_token_secret="XXXX"
>    auth=tweepy.OAuthHandler(consumer_key, consumer_secret)
>    auth.set_access_token(access_token, access_token_secret)
>    api=tweepy.API(auth)
>    status=api.user_timeline()
>    for status in status:
>        if status:
>            status.__getstate__()
>            return render_to_response('tweet.html',
> context_instance=RequestContext(request))

I'm not sure this is the best place to ask how to use tweepy*. I know
about django, not tweepy, so I can't tell you if you are using the
tweepy API correctly.

You're returning inside a loop. This means that the first time status
is true, you will exit the loop. I'm not sure that is intentional.

>
> Template:
> {% extends "base.html" %}
>
>  {% block content %}
>
>  {% for status in status %}

'for status in status' is probably going to work, but why be so
confusing? Also, what is this 'status' variable? You are passing no
variables named status to the template - in fact, you're not passing
anything.

Cheers

Tom

* This is one of my pet peeves. Just because you are using django +
(random bit of software), it doesn't mean you well get good support
for (random bit of software) on the django mailing lists.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment