def send(self, data, headers): kwargs = dict(method='POST', headers=headers, body=data) # only use async if ioloop is running, otherwise it will never send if ioloop.IOLoop.initialized(): client = AsyncHTTPClient() kwargs['callback'] = None else: client = HTTPClient() client.fetch(self._url, **kwargs)