Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Ubersmith API Client for Python

Usage
-----

.. code:: python

import ubersmith_client
Expand All @@ -20,7 +21,7 @@ Usage
>>> 1265

API
---------
---

**ubersmith_client.api.init(url, user, password, timeout, use_http_get)**
:url:
Expand Down
3 changes: 2 additions & 1 deletion tests/ubersmith_request_form_encoding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion tests/ubersmith_request_get_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion tests/ubersmith_request_post_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion ubersmith_client/ubersmith_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions ubersmith_client/ubersmith_request_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions ubersmith_client/ubersmith_request_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)