def postMsg(): try: Auth = tweepyAuth() screen_name = Auth.postMsg() return render_template('postmsg.html', user=screen_name) except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'postMsg: ' + str(e))
def logout(): try: Auth = tweepyAuth() Auth.logout() return redirect('/') except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'logout: ' + str(e))
def login(): try: Auth = tweepyAuth() url = Auth.login() return redirect(url) except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'login: ' + str(e))
def send(): try: text = request.form['text'] log.info(text) Auth = tweepyAuth() Auth.send(text) return redirect('/postMsg') except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'send: ' + str(e))
def loggedin(): try: if 'denied' in request.url: log.error(u'You denied request to sign in') return redirect('/') Auth = tweepyAuth() Auth.loggedin() return redirect('/postMsg') except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'loggedin: ' + str(e))
def readMsg(): try: Auth = tweepyAuth() statuses,user = Auth.readMsg() posts = [] for status in statuses: item = {'date': status.created_at, 'msg':status.text} posts.append(item) return render_template('readmsg.html', user = user, posts=posts) except Exception, e: log.exception(e) return render_template('error.html', errormsg = 'readMsg: ' + str(e))