Commits

Anonymous committed e954155 Merge

Available langs method and appropriate test added

Comments (0)

Files changed (1)

+# -*- coding: utf-8 -*-
 
 try:
     import json
         return self.name
         
 class Taus:
-
     URL = "http://www.tausdata.org/api/"
     POST = 1
     GET = 2
 
     def __init__(self):
-
         self.conn = pycurl.Curl()
         self.json_decoder = json.JSONDecoder()
 
     def authenticate(self, login, password):
-
         self.auth_key = None
         self.conn.setopt(pycurl.USERPWD, "%s:%s" % (login, password))
         self._perform_action(Taus.POST, 'auth_key', {'action': 'login'}, self._on_receive_authentication)
         self._temp_data += data  
         
     def set_lang(self, source_lang, target_lang):
-
         self.source_lang = source_lang
         self.target_lang = target_lang
 
             'action': 'segment',
             'source_lang': self.source_lang,
             'target_lang': self.target_lang}
+
         self._perform_action(Taus.GET, 'segment', params, self._on_receive_segment)
 
         return self._parse_result(self._temp_data, allowed_codes = [200])
         self._temp_data += data        
 
     def _parse_result(self, data, allowed_codes = [200]):
-
         decoded = self.json_decoder.decode(data)
         if allowed_codes.count(decoded['status']) == 0:
             raise TausException(decoded)
         return decoded
 
     def _perform_action(self, method, action, params, write_function):
-
         self._temp_data = ''
         action += '.json'
         if self.auth_key: