python-unifi-client 1.1.2__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_unifi_client
3
- Version: 1.1.2
3
+ Version: 1.2.0
4
4
  Home-page: https://github.com/compdat-llc/unifi-client-python
5
5
  Author: Michael Lapinski
6
6
  Author-email: michaellapinski787@gmail.com
@@ -10,9 +10,7 @@ import http.client as http_client
10
10
  import logging
11
11
  import base64
12
12
 
13
- logging.basicConfig(level=logging.DEBUG)
14
- logging.getLogger('requests.packages.urllib3').setLevel(logging.DEBUG)
15
- http_client.HTTPConnection.debuglevel = 1
13
+
16
14
 
17
15
  # Custom exceptions mirroring PHP equivalents
18
16
  class CurlExtensionNotLoadedException(Exception):
@@ -81,7 +79,7 @@ class Client:
81
79
  CURL_METHODS_ALLOWED = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH']
82
80
  DEFAULT_CURL_METHOD = 'GET'
83
81
 
84
- def __init__(self, user, password, baseurl='https://32.218.193.188', site='default', version='8.0.28', ssl_verify=False, unificookie_name='unificookie'):
82
+ def __init__(self, user, password, baseurl='https://32.218.193.188', site='default', version='8.0.28', ssl_verify=False, unificookie_name='unificookie', debug=False):
85
83
  # Initial setup mirrors PHP constructor
86
84
  self._check_curl()
87
85
  self._check_base_url(baseurl)
@@ -109,7 +107,12 @@ class Client:
109
107
  self._last_results_raw = None
110
108
  self._cookies_created_at = 0
111
109
  self._exec_retries = 0
112
- self.debug = False
110
+ self.debug = debug
111
+
112
+ if self.debug:
113
+ logging.basicConfig(level=logging.DEBUG)
114
+ logging.getLogger('requests.packages.urllib3').setLevel(logging.DEBUG)
115
+ http_client.HTTPConnection.debuglevel = 1
113
116
 
114
117
  self._curl_headers = {
115
118
  'Accept': 'application/json',
@@ -1835,7 +1838,7 @@ class Client:
1835
1838
  """Generate a controller backup for the past N days."""
1836
1839
  payload = {'cmd': 'backup', 'days': days}
1837
1840
  result = self.fetch_results(f"/proxy/network/api/s/{self._site}/cmd/backup", payload=payload, prefix_path=False, boolean=False)
1838
- print(f"RAW RESULT FROM FETCH_RESULTS(): {result}")
1841
+ print(f"RAW RESULT FROM FETCH_RESULTS(): {result}") if self.debug else None
1839
1842
  return result
1840
1843
 
1841
1844
  def download_backup(self, filepath: str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_unifi_client
3
- Version: 1.1.2
3
+ Version: 1.2.0
4
4
  Home-page: https://github.com/compdat-llc/unifi-client-python
5
5
  Author: Michael Lapinski
6
6
  Author-email: michaellapinski787@gmail.com
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="python_unifi_client",
8
- version="1.1.2",
8
+ version="1.2.0",
9
9
  author="Michael Lapinski",
10
10
  author_email="michaellapinski787@gmail.com",
11
11
  descripton="A python version of a github Art-of-Wifi/Unifi-API-Client",