From fff10f28cf9b6a9c8c40c5eed67e4edc70a1a35d Mon Sep 17 00:00:00 2001 From: Robbert Verbruggen Date: Wed, 7 Oct 2020 10:24:26 +0200 Subject: [PATCH 1/6] Update setup.py Update the version number to the next dev iteration --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ff9b006..a6ba2d7 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,11 @@ """Rachiopy setup script.""" from setuptools import find_packages, setup -VERSION = "1.0.2" +from datetime import datetime + +NOW = datetime.now().strftime("%m%d%Y%H%M%S") + +VERSION = f"1.0.3-dev{NOW}" GITHUB_USERNAME = "rfverbruggen" GITHUB_REPOSITORY = "rachiopy" From 332dbe584d7dd1a0b8d30c4f8cbd7cdeadb88399 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Wed, 7 Oct 2020 11:46:31 -0400 Subject: [PATCH 2/6] Add timeout --- rachiopy/rachioobject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rachiopy/rachioobject.py b/rachiopy/rachioobject.py index bb3bc22..66a37e3 100644 --- a/rachiopy/rachioobject.py +++ b/rachiopy/rachioobject.py @@ -4,6 +4,7 @@ from requests import Session _API_URL = "https://api.rach.io/1/public" +_TIMEOUT = 25 class RachioObject: @@ -39,7 +40,7 @@ def _request(self, path: str, method: str, body=None): url = f"{_API_URL}/{path}" response = self._http_session.request( - method, url, headers=self._headers, data=body + method, url, headers=self._headers, data=body, timeout=_TIMEOUT ) content_type = response.headers.get("content-type") From 0d50d3b479e99dd88f593ee25439ac6e4d8528de Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Thu, 8 Oct 2020 10:20:44 -0400 Subject: [PATCH 3/6] make timeout positional --- rachiopy/rachioobject.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rachiopy/rachioobject.py b/rachiopy/rachioobject.py index 66a37e3..59ff970 100644 --- a/rachiopy/rachioobject.py +++ b/rachiopy/rachioobject.py @@ -4,13 +4,12 @@ from requests import Session _API_URL = "https://api.rach.io/1/public" -_TIMEOUT = 25 class RachioObject: """The Rachio base object.""" - def __init__(self, authtoken: str, http_session=None): + def __init__(self, authtoken: str, http_session=None, timeout=25): """Rachioobject class initializer. :param authtoken: The API authentication token. @@ -18,6 +17,10 @@ def __init__(self, authtoken: str, http_session=None): :param http_session: The HTTP Session :type http_session: Session + + :param timeout: How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple. + :type timeout: float + :type timeout: tuple """ self.authtoken = authtoken self._headers = { @@ -25,6 +28,7 @@ def __init__(self, authtoken: str, http_session=None): "Authorization": f"Bearer {authtoken}", } self._http_session = http_session or Session() + self.timeout = timeout def _request(self, path: str, method: str, body=None): """Make a request from the API. @@ -40,7 +44,7 @@ def _request(self, path: str, method: str, body=None): url = f"{_API_URL}/{path}" response = self._http_session.request( - method, url, headers=self._headers, data=body, timeout=_TIMEOUT + method, url, headers=self._headers, data=body, timeout=self.timeout ) content_type = response.headers.get("content-type") From 354f6bd6a3c31b2724391f655ede182a13082bc2 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Thu, 8 Oct 2020 10:22:32 -0400 Subject: [PATCH 4/6] update string --- rachiopy/rachioobject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rachiopy/rachioobject.py b/rachiopy/rachioobject.py index 59ff970..c9c5546 100644 --- a/rachiopy/rachioobject.py +++ b/rachiopy/rachioobject.py @@ -18,7 +18,8 @@ def __init__(self, authtoken: str, http_session=None, timeout=25): :param http_session: The HTTP Session :type http_session: Session - :param timeout: How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple. + :param timeout: How long to wait for the server to send data before + giving up, as a float, or a (connect timeout, read timeout) tuple. :type timeout: float :type timeout: tuple """ From df1283a1e98c8927746adaaeef3da0f756ca8c58 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Thu, 8 Oct 2020 10:23:15 -0400 Subject: [PATCH 5/6] oops --- rachiopy/rachioobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rachiopy/rachioobject.py b/rachiopy/rachioobject.py index c9c5546..f519908 100644 --- a/rachiopy/rachioobject.py +++ b/rachiopy/rachioobject.py @@ -18,7 +18,7 @@ def __init__(self, authtoken: str, http_session=None, timeout=25): :param http_session: The HTTP Session :type http_session: Session - :param timeout: How long to wait for the server to send data before + :param timeout: How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple. :type timeout: float :type timeout: tuple From 58bfc6f33fe0d9bac91e18db37f29e4f9e6b24ed Mon Sep 17 00:00:00 2001 From: Robbert Verbruggen Date: Sat, 10 Oct 2020 12:53:47 +0200 Subject: [PATCH 6/6] Update the version number to 1.0.3 --- setup.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/setup.py b/setup.py index a6ba2d7..6674fd2 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,7 @@ """Rachiopy setup script.""" from setuptools import find_packages, setup -from datetime import datetime - -NOW = datetime.now().strftime("%m%d%Y%H%M%S") - -VERSION = f"1.0.3-dev{NOW}" +VERSION = "1.0.3" GITHUB_USERNAME = "rfverbruggen" GITHUB_REPOSITORY = "rachiopy"