pyGuardPoint 2.1.0__tar.gz → 2.1.1__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.
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/PKG-INFO +1 -1
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/guardpoint_connection_asyncio.py +56 -40
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_connection.py +2 -2
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_dataclasses.py +10 -8
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/PKG-INFO +1 -1
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/setup.py +1 -1
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/LICENSE.txt +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/README.rst +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/CustomWebsocketTransport.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/CustomWebsocketTransportOld.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/__init__.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_accessgroups.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_alarmstates.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_alarmzones.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_areas.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_cardholders.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_cardholdertypes.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_cards.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_controllers.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_customizedfields.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_departments.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_diagnostic.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_events.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_genericinformation.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_inputs.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_manualevents.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_ouputs.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_personaldetails.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_readers.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_scheduledmags.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_securitygroups.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_sites.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_guardpoint_weeklyprograms.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_odata_filter.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/_str_match_algo.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/__init__.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_accessgroups.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_alarmstates.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_alarmzones.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_areas.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_cardholders.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_cardholdertypes.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_cards.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_controllers.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_customizedfields.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_departments.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_diagnostic.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_events.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_genericinformation.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_manualevents.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_ouputs.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_personaldetails.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_readers.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_scheduledmags.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_securitygroups.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_sites.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_weeklyprograms.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_asyncio.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_error.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_threaded.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/guardpoint_utils.py +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/SOURCES.txt +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/dependency_links.txt +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/not-zip-safe +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/requires.txt +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint.egg-info/top_level.txt +0 -0
- {pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/setup.cfg +0 -0
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/guardpoint_connection_asyncio.py
RENAMED
|
@@ -172,11 +172,11 @@ class GuardPointConnection:
|
|
|
172
172
|
if code != 200:
|
|
173
173
|
return code, auth_body
|
|
174
174
|
if self.auto_renew:
|
|
175
|
-
if self.token_expiry < (time.time()
|
|
175
|
+
if self.token_expiry < (time.time() + (20 * 60)) and self.token_expiry > time.time():
|
|
176
176
|
code, auth_body = await self._renew_token()
|
|
177
177
|
if code != 200:
|
|
178
178
|
return code, auth_body
|
|
179
|
-
|
|
179
|
+
elif self.token_expiry < time.time():
|
|
180
180
|
code, auth_body = await self._new_token()
|
|
181
181
|
if code != 200:
|
|
182
182
|
return code, auth_body
|
|
@@ -220,54 +220,70 @@ class GuardPointConnection:
|
|
|
220
220
|
json_body = None
|
|
221
221
|
except InvalidURL as e:
|
|
222
222
|
log.error(str(e))
|
|
223
|
-
return
|
|
223
|
+
return 400, {"error": str(e)}
|
|
224
224
|
except Exception as e:
|
|
225
225
|
log.error(str(e))
|
|
226
|
-
return
|
|
226
|
+
return 500, {"error": str(e)}
|
|
227
227
|
|
|
228
228
|
elif method.lower() == "post":
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
229
|
+
try:
|
|
230
|
+
async with self.session.post(url, data=raw_body, headers=headers) as response:
|
|
231
|
+
body = await response.text()
|
|
232
|
+
try:
|
|
233
|
+
json_body = json.loads(body)
|
|
234
|
+
except JSONDecodeError:
|
|
235
|
+
json_body = None
|
|
236
|
+
except Exception as e:
|
|
237
|
+
log.error(e)
|
|
238
|
+
json_body = None
|
|
239
|
+
except Exception as e:
|
|
240
|
+
log.error(str(e))
|
|
241
|
+
return 500, {"error": str(e)}
|
|
238
242
|
|
|
239
243
|
elif method.lower() == "patch":
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
try:
|
|
245
|
+
async with self.session.patch(url, data=raw_body, headers=headers) as response:
|
|
246
|
+
body = await response.text()
|
|
247
|
+
try:
|
|
248
|
+
json_body = json.loads(body)
|
|
249
|
+
except JSONDecodeError:
|
|
250
|
+
json_body = None
|
|
251
|
+
except Exception as e:
|
|
252
|
+
log.error(e)
|
|
253
|
+
json_body = None
|
|
254
|
+
except Exception as e:
|
|
255
|
+
log.error(str(e))
|
|
256
|
+
return 500, {"error": str(e)}
|
|
249
257
|
|
|
250
258
|
elif method.lower() == "delete":
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
try:
|
|
260
|
+
async with self.session.delete(url, data=raw_body, headers=headers) as response:
|
|
261
|
+
body = await response.text()
|
|
262
|
+
try:
|
|
263
|
+
json_body = json.loads(body)
|
|
264
|
+
except JSONDecodeError:
|
|
265
|
+
json_body = None
|
|
266
|
+
except Exception as e:
|
|
267
|
+
log.error(e)
|
|
268
|
+
json_body = None
|
|
269
|
+
except Exception as e:
|
|
270
|
+
log.error(str(e))
|
|
271
|
+
return 500, {"error": str(e)}
|
|
260
272
|
|
|
261
273
|
elif method.lower() == "put":
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
274
|
+
try:
|
|
275
|
+
async with self.session.put(url, data=raw_body, headers=headers) as response:
|
|
276
|
+
body = await response.text()
|
|
277
|
+
try:
|
|
278
|
+
json_body = json.loads(body)
|
|
279
|
+
except JSONDecodeError:
|
|
280
|
+
json_body = None
|
|
281
|
+
except Exception as e:
|
|
282
|
+
log.error(e)
|
|
283
|
+
json_body = None
|
|
284
|
+
except Exception as e:
|
|
285
|
+
log.error(str(e))
|
|
286
|
+
return 500, {"error": str(e)}
|
|
271
287
|
|
|
272
288
|
else:
|
|
273
289
|
raise ValueError("Method Not Supported")
|
|
@@ -185,11 +185,11 @@ class GuardPointConnection:
|
|
|
185
185
|
if code != 200:
|
|
186
186
|
return code, auth_body
|
|
187
187
|
if self.auto_renew:
|
|
188
|
-
if self.token_expiry < (time.time()
|
|
188
|
+
if self.token_expiry < (time.time() + (20 * 60)) and self.token_expiry > time.time():
|
|
189
189
|
code, auth_body = self._renew_token()
|
|
190
190
|
if code != 200:
|
|
191
191
|
return code, auth_body
|
|
192
|
-
|
|
192
|
+
elif self.token_expiry < time.time():
|
|
193
193
|
code, auth_body = self._new_token()
|
|
194
194
|
if code != 200:
|
|
195
195
|
return code, auth_body
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import threading
|
|
2
3
|
from collections import defaultdict
|
|
3
4
|
from dataclasses import dataclass, asdict, field
|
|
4
5
|
from enum import Enum
|
|
@@ -18,20 +19,21 @@ class EventOrder(Enum):
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class Observable:
|
|
21
|
-
# A set of all attributes which get changed
|
|
22
|
-
changed_attributes = set()
|
|
23
|
-
|
|
24
22
|
def __init__(self):
|
|
25
|
-
|
|
23
|
+
super().__setattr__('changed_attributes', set())
|
|
24
|
+
super().__setattr__('observed', defaultdict(list))
|
|
25
|
+
super().__setattr__('_observer_lock', threading.RLock())
|
|
26
26
|
|
|
27
27
|
def __setattr__(self, name, value):
|
|
28
28
|
super().__setattr__(name, value)
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
observer(name)
|
|
30
|
+
with self._observer_lock:
|
|
31
|
+
for observer in self.observed.get(name, []):
|
|
32
|
+
observer(name)
|
|
32
33
|
|
|
33
34
|
def add_observer(self, name):
|
|
34
|
-
self.
|
|
35
|
+
with self._observer_lock:
|
|
36
|
+
self.observed[name].append(lambda name: self.changed_attributes.add(name))
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
def sanitise_args(obj: Observable, args, kwargs):
|
|
@@ -1219,7 +1221,7 @@ class Cardholder(Observable):
|
|
|
1219
1221
|
try:
|
|
1220
1222
|
if isinstance(getattr(self, property_name), str):
|
|
1221
1223
|
value = str(value)
|
|
1222
|
-
except:
|
|
1224
|
+
except AttributeError:
|
|
1223
1225
|
pass
|
|
1224
1226
|
|
|
1225
1227
|
|
|
@@ -5,7 +5,7 @@ long_description = open('README.rst').read()
|
|
|
5
5
|
setup(name="pyGuardPoint",
|
|
6
6
|
python_requires='>3.9.0',
|
|
7
7
|
packages=find_packages(),
|
|
8
|
-
version="2.1.
|
|
8
|
+
version="2.1.1",
|
|
9
9
|
author="John Owen",
|
|
10
10
|
description="Python wrapper for GuardPoint 10 Access Control System",
|
|
11
11
|
long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_accessgroups.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_alarmstates.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_alarmzones.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_areas.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_cardholders.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_cards.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_controllers.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_departments.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_diagnostic.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_events.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_manualevents.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_ouputs.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_readers.py
RENAMED
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_scheduledmags.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyguardpoint-2.1.0 → pyguardpoint-2.1.1}/pyGuardPoint/gp_asyncio/_async_guardpoint_sites.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|