|Shane Spencer||5/23/13 12:36 PM|
I wish other people were running into these problems so that google would return the answers.
So I am using coroutines just like in the documentation for the TwitterMixIn.. infact it is direct copy/paste.
I get a response back from the Twitter OAUTH service, however self._headers_written) is set BEFORE self._on_request_token is called.. making the redirect at the end of it useless and it throws an exception of course.
I'm not entirely sure where to start diagnosing this problem... could this be because I am not yielding the authenticate_redirect/authorize_redirect or returning it directly?
|Re:||sh...@bogomip.com||5/23/13 1:17 PM|
Apparently I failed to use a subject line.. my apologies.
|Re: [tornado]||Ben Darnell||5/23/13 7:31 PM|
On Thu, May 23, 2013 at 3:36 PM, Shane Spencer <sh...@bogomip.com> wrote:
This is often caused by a missing @asynchronous decorator, but if you've got that the next thing to look at is what exactly were the headers that were written? Did something generate an error, or did the request finish "successfully"?
No, you don't need to yield or return the authorize_redirect call.
|Re: [tornado]||Shane Spencer||5/23/13 7:56 PM|
Well now it's saying the request token is invalid (from Twitter) so as soon as I fix that.. I'll be able to test this.
In the mean time I moved over to OneAll for auth.. it blended right in to Tornado.
|Re:||m_ob...@onet.eu||5/28/13 10:29 PM|
I think I've got the same problem in this code:
# -*- coding: utf-8 -*-
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class MainHandler(BaseHandler, tornado.auth.TwitterMixin):
if self.get_argument("oauth_token", None):
user = yield self.get_authenticated_user()
if not user:
raise tornado.web.HTTPError(500, "Twitter auth failed")
handlers = [
settings = dict(
tornado.web.Application.__init__(self, handlers, **settings)
if __name__ == "__main__":
app = Application()
http_server = tornado.httpserver.HTTPServer(app)
It works after changing @tornado.gen.coroutine to @tornado.gen.engine.
|Re: [tornado] Re:||Алексей Силк||5/29/13 5:49 AM|
I use old way. Still don't understand how to use in new way! If you'll handle that, please inform me ...
С уважением, Алексей Силк
With best regards, Aleksey Silk
+7 (981) 849-12-36
skype - rootiks
2013/5/29 m_ob...@onet.eu <m_ob...@onet.eu>
|Re: [tornado] Re:||Ben Darnell||5/29/13 6:20 AM|
Ah, I see what's happening. The auth*_redirect methods don't return Futures so they can't be yielded, but they should. As a workaround for now you can continue to use @gen.engine and call these methods without yielding.