You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current code does not support patching anything that isnt a subclass of a RequestHandler object due to the use of the @tornado.web.asynchronous decorator.
test.py
import logging
from tornado import ioloop
from tornado import gen
from trequests import setup_session
from tornalet import tornalet
from rightscale import commands as rightscale_commands
from rightscale import util as rightscale_util
Tell requests to use our AsyncHTTPadapter for the default
session instance, you can also pass you own through
setup_session()
class RightScaleAPI(object):
def init(self, token, api='http://my.rightscale.com'):
self._token = token
self._api = api
@tornalet
def find(self, name, exact=True):
# Blocking login and then blocking search call
self._obj = rightscale.RightScale(refresh_token=self._token, api_endpoint=self._api)
sa = rightscale_util.find_by_name(self._obj.server_arrays, name, exact=exact)
@gen.coroutine
def main():
actions = []
res = None
for x in xrange(1,10):
actions.append(RightScaleAPI('asdf').find('staging'))
res = yield actions
raise gen.Return(True)
if name == 'main':
try:
log.info('Starting up')
ioloop.IOLoop.instance().run_sync(main)
log.info('Done')
except KeyboardInterrupt:
log.info('CTRL-C caught, shutting down')
cleanup()
failure
INFO:main:Starting up
Traceback (most recent call last):
File "test.py", line 51, in
ioloop.IOLoop.instance().run_sync(main)
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/ioloop.py", line 370, in run_sync
return future_cell[0].result()
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/concurrent.py", line 129, in result
raise_exc_info(self.__exc_info)
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/gen.py", line 221, in wrapper
runner.run()
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/gen.py", line 507, in run
yielded = self.gen.send(next)
File "test.py", line 39, in main
actions.append(RightScaleAPI('asdf').find('staging'))
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/web.py", line 1293, in wrapper
if self.application._wsgi:
AttributeError: 'RightScaleAPI' object has no attribute 'application'
The text was updated successfully, but these errors were encountered:
The current code does not support patching anything that isnt a subclass of a RequestHandler object due to the use of the
@tornado.web.asynchronous
decorator.test.py
import logging
from tornado import ioloop
from tornado import gen
from trequests import setup_session
from tornalet import tornalet
from rightscale import commands as rightscale_commands
from rightscale import util as rightscale_util
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(name)
Tell requests to use our AsyncHTTPadapter for the default
session instance, you can also pass you own through
setup_session()
class RightScaleAPI(object):
def init(self, token, api='http://my.rightscale.com'):
self._token = token
self._api = api
@gen.coroutine
def main():
actions = []
res = None
for x in xrange(1,10):
actions.append(RightScaleAPI('asdf').find('staging'))
res = yield actions
raise gen.Return(True)
if name == 'main':
try:
log.info('Starting up')
ioloop.IOLoop.instance().run_sync(main)
log.info('Done')
except KeyboardInterrupt:
log.info('CTRL-C caught, shutting down')
cleanup()
failure
INFO:main:Starting up
Traceback (most recent call last):
File "test.py", line 51, in
ioloop.IOLoop.instance().run_sync(main)
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/ioloop.py", line 370, in run_sync
return future_cell[0].result()
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/concurrent.py", line 129, in result
raise_exc_info(self.__exc_info)
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/gen.py", line 221, in wrapper
runner.run()
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/gen.py", line 507, in run
yielded = self.gen.send(next)
File "test.py", line 39, in main
actions.append(RightScaleAPI('asdf').find('staging'))
File "/Users/diranged/git/Nextdoor/kingpin/.venv/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/web.py", line 1293, in wrapper
if self.application._wsgi:
AttributeError: 'RightScaleAPI' object has no attribute 'application'
The text was updated successfully, but these errors were encountered: