diff --git a/README.rst b/README.rst index a9b3e73..b9bb651 100755 --- a/README.rst +++ b/README.rst @@ -9,6 +9,7 @@ Ubersmith API Client for Python Usage ----- + .. code:: python import ubersmith_client @@ -20,7 +21,7 @@ Usage >>> 1265 API ---------- +--- **ubersmith_client.api.init(url, user, password, timeout, use_http_get)** :url: diff --git a/tests/ubersmith_request_form_encoding_test.py b/tests/ubersmith_request_form_encoding_test.py index 1337ccc..1f5d747 100644 --- a/tests/ubersmith_request_form_encoding_test.py +++ b/tests/ubersmith_request_form_encoding_test.py @@ -26,7 +26,8 @@ def setUp(self): sentinel.module, sentinel.timeout) self._standard_kwargs = dict(auth=(sentinel.username, sentinel.password), timeout=sentinel.timeout, - url=sentinel.url) + url=sentinel.url, + headers={'user-agent': 'python-ubersmithclient'}) @patch('ubersmith_client.ubersmith_request_get.requests') def test_get_with_list(self, request_mock): diff --git a/tests/ubersmith_request_get_test.py b/tests/ubersmith_request_get_test.py index 3717e8c..aad5f47 100644 --- a/tests/ubersmith_request_get_test.py +++ b/tests/ubersmith_request_get_test.py @@ -72,7 +72,8 @@ def expect_a_ubersmith_call(self, requests_mock, returning=None, **kwargs): response.json = MagicMock(return_value=returning) def assert_called_with(): - requests_mock.get.assert_called_with(auth=self.auth, params=kwargs, timeout=self.timeout, url=self.url) + requests_mock.get.assert_called_with(auth=self.auth, params=kwargs, timeout=self.timeout, url=self.url, + headers={'user-agent': 'python-ubersmithclient'}) response.json.assert_called_with() return assert_called_with diff --git a/tests/ubersmith_request_post_test.py b/tests/ubersmith_request_post_test.py index 1149c0d..edab750 100644 --- a/tests/ubersmith_request_post_test.py +++ b/tests/ubersmith_request_post_test.py @@ -83,7 +83,8 @@ def expect_a_ubersmith_call_post(self, requests_mock, returning=None, status_cod response.json = MagicMock(return_value=returning) def assert_called_with(): - requests_mock.post.assert_called_with(auth=self.auth, timeout=self.timeout, url=self.url, data=kwargs) + requests_mock.post.assert_called_with(auth=self.auth, timeout=self.timeout, url=self.url, data=kwargs, + headers={'user-agent': 'python-ubersmithclient'}) response.json.assert_called_with() return assert_called_with diff --git a/ubersmith_client/ubersmith_request.py b/ubersmith_client/ubersmith_request.py index 4a807fc..15abb32 100644 --- a/ubersmith_client/ubersmith_request.py +++ b/ubersmith_client/ubersmith_request.py @@ -38,7 +38,6 @@ def __call__(self, **kwargs): def _process_request(self, method, **kwargs): try: return method(**kwargs) - except ConnectionError: raise exceptions.UbersmithConnectionError(self.url) except Timeout: diff --git a/ubersmith_client/ubersmith_request_get.py b/ubersmith_client/ubersmith_request_get.py index 37d4cce..3a29dc6 100644 --- a/ubersmith_client/ubersmith_request_get.py +++ b/ubersmith_client/ubersmith_request_get.py @@ -27,6 +27,7 @@ def __call__(self, **kwargs): url=self.url, auth=(self.user, self.password), timeout=self.timeout, + headers={'user-agent': 'python-ubersmithclient'}, params=params) return UbersmithRequest.process_ubersmith_response(response) diff --git a/ubersmith_client/ubersmith_request_post.py b/ubersmith_client/ubersmith_request_post.py index 9cc7742..6bbf2b4 100644 --- a/ubersmith_client/ubersmith_request_post.py +++ b/ubersmith_client/ubersmith_request_post.py @@ -27,6 +27,7 @@ def __call__(self, **kwargs): url=self.url, auth=(self.user, self.password), timeout=self.timeout, + headers={'user-agent': 'python-ubersmithclient'}, data=params) return UbersmithRequest.process_ubersmith_response(response)