Beispiel #1
0
def home_view(request):
    screen_name, name, profile_image_url = get_screen_name(request.session)
    return dict(
        screen_name=screen_name,
        name=name,
        profile_image_url=profile_image_url,
    )
Beispiel #2
0
    if request.params.get('q') == '':
        initial_query = None
    else:
        initial_query = request.params.get('q')
    api = twitter.Api(
        consumer_key=settings['consumer_key'],
        consumer_secret=settings['consumer_secret'],
        access_token_key=session['oauth_token'],
        access_token_secret=session['oauth_token_secret'],
    )
    try:
        search_result = api.GetSearch(term=initial_query, count=number_tweet)
    except twitter.TwitterError, e:
        print(e)
        return HTTPServiceUnavailable("WTF ?")
    screen_name, name, profile_image_url = get_screen_name(request.session)
    return dict(
        tweets=search_result,
        q=initial_query,
        screen_name=screen_name,
        name=name,
        profile_image_url=profile_image_url,
    )


@view_config(route_name='my_timeline', renderer='templates/my_timeline.mako')
def my_timeline_view(request):
    """
    function to get the authenticated user home timeline
    """
    session = request.session