accsyn-python-api 3.2.2__tar.gz → 3.2.3__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.
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/PKG-INFO +1 -1
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/pyproject.toml +1 -1
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/source/accsyn_api/_version.py +1 -1
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/source/accsyn_api/session.py +13 -7
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/README.md +0 -0
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/source/accsyn_api/__init__.py +0 -0
- {accsyn_python_api-3.2.2 → accsyn_python_api-3.2.3}/source/accsyn_api/_devtools.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "accsyn-python-api"
|
|
7
|
-
version = "3.2.
|
|
7
|
+
version = "3.2.3"
|
|
8
8
|
description = "A Python API for accsyn programmable fast and secure data delivery software"
|
|
9
9
|
authors = ["Henrik Norin <support@accsyn.com>"]
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -468,6 +468,7 @@ class Session(object):
|
|
|
468
468
|
skip: Optional[int] = None,
|
|
469
469
|
create: bool = False,
|
|
470
470
|
update: bool = False,
|
|
471
|
+
single_entity_query: bool = False,
|
|
471
472
|
) -> Optional[List[Dict[str, Any]]]:
|
|
472
473
|
"""
|
|
473
474
|
Return (GET) a list of entities/entitytypes/attributes based on *query*.
|
|
@@ -483,6 +484,7 @@ class Session(object):
|
|
|
483
484
|
:param skip: The amount of entities to skip.
|
|
484
485
|
:param create: (attributes) Return create (POST) attributes.
|
|
485
486
|
:param update: (attributes) Return update (PUT) attributes.
|
|
487
|
+
:param single_entity_query: It is a single entity query, tell backend to be more relaxed regarding status scope.
|
|
486
488
|
:return: List of dictionaries.
|
|
487
489
|
"""
|
|
488
490
|
assert 0 < len(query or "") and Session._is_str(query), "Invalid query type supplied, must be of string type!"
|
|
@@ -555,9 +557,18 @@ class Session(object):
|
|
|
555
557
|
data["skip"] = skip
|
|
556
558
|
if attributes:
|
|
557
559
|
data["attributes"] = attributes
|
|
560
|
+
if single_entity_query:
|
|
561
|
+
data["single_entity_query"] = single_entity_query
|
|
558
562
|
response = self._event("GET", f"{d['entitytype']}/find", data, query=d.get("expression"))
|
|
559
563
|
if response:
|
|
560
564
|
retval = response["result"]
|
|
565
|
+
if single_entity_query:
|
|
566
|
+
if retval and 0 < len(retval):
|
|
567
|
+
if 1 < len(retval):
|
|
568
|
+
Session._warning(f"Multiple entities retreived({len(retval)}), returning first one.")
|
|
569
|
+
single_retval = retval[0]
|
|
570
|
+
return single_retval
|
|
571
|
+
return None
|
|
561
572
|
return retval
|
|
562
573
|
|
|
563
574
|
def find_one(
|
|
@@ -583,19 +594,14 @@ class Session(object):
|
|
|
583
594
|
assert 0 < len(query or "") and (
|
|
584
595
|
Session._is_str(query)
|
|
585
596
|
), "Invalid query type supplied, must be of string type!"
|
|
586
|
-
|
|
597
|
+
return self.find(
|
|
587
598
|
query,
|
|
588
599
|
attributes=attributes,
|
|
589
600
|
finished=finished,
|
|
590
601
|
inactive=inactive or offline,
|
|
591
602
|
archived=archived,
|
|
603
|
+
single_entity_query=True,
|
|
592
604
|
)
|
|
593
|
-
if result and 0 < len(result):
|
|
594
|
-
retval = result[0]
|
|
595
|
-
if 1 < len(result):
|
|
596
|
-
Session._warning(f"Multiple entities retreived({len(result)}), returning first one.")
|
|
597
|
-
return retval
|
|
598
|
-
return None
|
|
599
605
|
|
|
600
606
|
def get_entity(self, entitytype: str, entityid: str) -> Optional[Dict[str, Any]]:
|
|
601
607
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|