def submit(self, te):
        """Submit the transaction using a pooled connection, and retry on failure.

        `POST /transactions
        <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html>`_

        Uses form-encoded data to send over to Horizon.

        :return: The JSON response indicating the success/failure of the
            submitted transaction.
        :rtype: dict

        """
        params = {'tx': te}
        url = urljoin(self.horizon_uri, 'transactions/')

        # POST is not included in Retry's method_whitelist for a good reason.
        # our custom retry mechanism follows
        reply = None
        retry_count = self.num_retries
        while True:
            try:
                reply = self._session.post(
                    url, data=params, timeout=self.request_timeout)
                return check_horizon_reply(reply.json())
            except (RequestException, NewConnectionError, ValueError) as e:
                if reply is not None:
                    msg = 'Horizon submit exception: {}, reply: [{}] {}'.format(
                        str(e), reply.status_code, reply.text)
                else:
                    msg = 'Horizon submit exception: {}'.format(str(e))
                logging.warning(msg)

                if (reply is not None and reply.status_code not in self.status_forcelist) or retry_count <= 0:
                    if reply is None:
                        raise HorizonRequestError(e)
                    raise HorizonError('Invalid horizon reply: [{}] {}'.format(
                        reply.status_code, reply.text), reply.status_code)
                retry_count -= 1
                logging.warning('Submit retry attempt {}'.format(retry_count))
                sleep(self.backoff_factor)
def submit ( self , te ) : params = { 'tx' : te } url = urljoin ( self . horizon_uri , 'transactions/' ) reply = None retry_count = self . num_retries while True : try : reply = self . _session . post ( url , data = params , timeout = self . request_timeout ) return check_horizon_reply ( reply . json ( ) ) except ( RequestException , NewConnectionError , ValueError ) as e : if reply is not None : msg = 'Horizon submit exception: {}, reply: [{}] {}' . format ( str ( e ) , reply . status_code , reply . text ) else : msg = 'Horizon submit exception: {}' . format ( str ( e ) ) logging . warning ( msg ) if ( reply is not None and reply . status_code not in self . status_forcelist ) or retry_count <= 0 : if reply is None : raise HorizonRequestError ( e ) raise HorizonError ( 'Invalid horizon reply: [{}] {}' . format ( reply . status_code , reply . text ) , reply . status_code ) retry_count -= 1 logging . warning ( 'Submit retry attempt {}' . format ( retry_count ) ) sleep ( self . backoff_factor )
Submit the transaction using a pooled connection, and retry on failure.

        `POST /transactions
        <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html>`_

        Uses form-encoded data to send over to Horizon.

        :return: The JSON response indicating the success/failure of the
            submitted transaction.
        :rtype: dict