def actor_post_update(request): access_token = request.user.extra.get('twitter_access_token', None) if access_token is None: return http.HttpResponseRedirect('/twitter/auth?redirect_to=/twitter/post_update') api_twitter = twitter.get_api(access_token) user = api_twitter.GetUserInfo() tiempo = time.localtime() status = api_twitter.PostUpdate('testing from with actor_post_update %s' % tiempo) c = template.RequestContext(request, locals()) t = loader.get_template('actor/templates/twitter_callback.html') return http.HttpResponse(t.render(c))
def twitter_user(): try: token = twitter.get_access_request() except: return False apitwitter = twitter.get_api(token) try: userinfo = apitwitter.GetUserInfo() except: logging.info("Error getting user info") return False, None return userinfo, token