Esempio n. 1
0
 def test_request(self, mock_request):
     transport = Transport()
     transport.request('act')
     mock_request.assert_called_with(
         'http://api.clickatell.com/act',
         params={},
         data='{}',
         headers={'User-Agent': 'ClickatellPython/0.1.0 httplib2 Python/' + platform.python_version()}
     )
Esempio n. 2
0
 def test_request(self, mock_request):
     transport = Transport()
     transport.request('act')
     mock_request.assert_called_with('http://api.clickatell.com/act',
                                     params={},
                                     data='{}',
                                     headers={
                                         'User-Agent':
                                         'ClickatellPython/0.1.2 Python/' +
                                         platform.python_version()
                                     })
Esempio n. 3
0
 def request(self, action, data={}, headers={}, method='GET'):
     """
     Append the user authentication details to every incoming request
     """
     data = self.merge(data, {
         'user': self.username,
         'password': self.password,
         'api_id': self.apiId
     })
     return Transport.request(self, action, data, headers, method)
Esempio n. 4
0
    def request(self, action, data={}, headers={}, method='GET'):
        """
        Append the REST headers to every request
        """
        headers = {
            "Authorization": self.apiKey,
            "Content-Type": "application/json",
            "Accept": "application/json"
        }

        return Transport.request(self, action, data, headers, method)
Esempio n. 5
0
    def request(self, action, data={}, headers={}, method='GET'):
        """
        Append the REST headers to every request
        """
        headers = {
            "Authorization": "Bearer " + self.token,
            "Content-Type": "application/json",
            "X-Version": "1",
            "Accept": "application/json"
        }

        return Transport.request(self, action, data, headers, method)
Esempio n. 6
0
 def request(self, action, data={}, headers={}, method='GET'):
     """
     Append the user authentication details to every incoming request
     """
     data = self.merge(data, {'user': self.username, 'password': self.password, 'api_id': self.apiId})
     return Transport.request(self, action, data, headers, method)
Esempio n. 7
0
 def test_request_return(self):
     transport = Transport()
     text = transport.request('404')
     # content is expected to return as a string
     self.assertFalse(isinstance(text, bytes))
Esempio n. 8
0
 def request(self, action, data={}, headers={}, method='GET'):
     """
     Append the user authentication details to every incoming request
     """
     data = self.merge(data, {'apiKey': self.apiKey})
     return Transport.request(self, action, data, headers, method)