<commit_before>from urllib import urlencode
from urllib2 import urlopen

from rapidsms.backends.base import BackendBase

class TropoBackend(BackendBase):
    """A RapidSMS threadless backend for Tropo"""

   def configure(self, config=None, **kwargs):
        self.config = config
        super(TropoBackend, self).configure(**kwargs)
        
   def send(self, message):
        base_url = 'http://api.tropo.com/1.0/sessions'
        token = self.config['auth_token']
        action = 'create'
        number = self.config['number']

        params = urlencode([('action', action), ('token', token), ('numberToDial', message.connection.identity), ('msg', message.text)])
        self.debug("%s?%s" % (base_url, params))
        data = urlopen('%s?%s' % (base_url, params)).read()
        self.debug(data)<commit_msg>Fix indentation; override old-style start() from BackendBase<commit_after>from urllib import urlencode
from urllib2 import urlopen

from rapidsms.backends.base import BackendBase

class TropoBackend(BackendBase):
    """A RapidSMS threadless backend for Tropo"""

    def configure(self, config=None, **kwargs):
        self.config = config
        
    def start(self):
        """Override BackendBase.start(), which never returns"""
        self._running = True

    def send(self, message):
        self.debug("send(%s)" % message)
        base_url = 'http://api.tropo.com/1.0/sessions'
        token = self.config['auth_token']
        action = 'create'
        number = self.config['number']

        params = urlencode([('action', action), ('token', token), ('numberToDial', message.connection.identity), ('msg', message.text)])
        self.debug("%s?%s" % (base_url, params))
        data = urlopen('%s?%s' % (base_url, params)).read()
        self.debug(data)
        return True
{'fraction_non_alphanumeric': 0.14736842105263157, 'fraction_numerical': 0.0033240997229916896, 'mean_word_length': 3.23943661971831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '612525', 'n_tokens_mistral': 556, 'n_tokens_neox': 551, 'n_words': 128}