Created
June 21, 2016 16:20
-
-
Save akx/388f1d9b5fa60c96d5c8f834be1005db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FireAndForgetThreadedHTTPTransport(AsyncTransport, HTTPTransport): | |
| scheme = ['http', 'https', 'faf+http', 'faf+https'] | |
| def send_sync(self, data, headers, success_cb, failure_cb): | |
| try: | |
| super(ThreadedHTTPTransport, self).send(data, headers) | |
| except Exception as e: | |
| failure_cb(e) | |
| else: | |
| success_cb() | |
| def async_send(self, data, headers, success_cb, failure_cb): | |
| threading.Thread( | |
| target=self.send_sync, | |
| args=(data, headers, success_cb, failure_cb) | |
| ).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment