sapiopycommons 2024.8.27a310__py3-none-any.whl → 2024.8.27a312__py3-none-any.whl

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.

Potentially problematic release.


This version of sapiopycommons might be problematic. Click here for more details.

Files changed (33) hide show
  1. sapiopycommons/callbacks/callback_util.py +37 -133
  2. sapiopycommons/datatype/attachment_util.py +10 -11
  3. sapiopycommons/eln/experiment_handler.py +48 -209
  4. sapiopycommons/eln/experiment_report_util.py +129 -33
  5. sapiopycommons/files/complex_data_loader.py +4 -5
  6. sapiopycommons/files/file_bridge.py +14 -15
  7. sapiopycommons/files/file_bridge_handler.py +5 -27
  8. sapiopycommons/files/file_data_handler.py +5 -2
  9. sapiopycommons/files/file_util.py +5 -38
  10. sapiopycommons/files/file_validator.py +11 -26
  11. sapiopycommons/files/file_writer.py +15 -44
  12. sapiopycommons/general/aliases.py +3 -147
  13. sapiopycommons/general/custom_report_util.py +32 -34
  14. sapiopycommons/general/popup_util.py +0 -17
  15. sapiopycommons/general/time_util.py +0 -40
  16. sapiopycommons/multimodal/multimodal_data.py +1 -0
  17. sapiopycommons/processtracking/endpoints.py +22 -22
  18. sapiopycommons/recordmodel/record_handler.py +77 -228
  19. sapiopycommons/rules/eln_rule_handler.py +25 -34
  20. sapiopycommons/rules/on_save_rule_handler.py +31 -34
  21. sapiopycommons/webhook/webhook_handlers.py +26 -90
  22. {sapiopycommons-2024.8.27a310.dist-info → sapiopycommons-2024.8.27a312.dist-info}/METADATA +1 -1
  23. sapiopycommons-2024.8.27a312.dist-info/RECORD +43 -0
  24. sapiopycommons/customreport/__init__.py +0 -0
  25. sapiopycommons/customreport/column_builder.py +0 -60
  26. sapiopycommons/customreport/custom_report_builder.py +0 -125
  27. sapiopycommons/customreport/term_builder.py +0 -299
  28. sapiopycommons/general/audit_log.py +0 -196
  29. sapiopycommons/general/sapio_links.py +0 -50
  30. sapiopycommons/webhook/webservice_handlers.py +0 -67
  31. sapiopycommons-2024.8.27a310.dist-info/RECORD +0 -50
  32. {sapiopycommons-2024.8.27a310.dist-info → sapiopycommons-2024.8.27a312.dist-info}/WHEEL +0 -0
  33. {sapiopycommons-2024.8.27a310.dist-info → sapiopycommons-2024.8.27a312.dist-info}/licenses/LICENSE +0 -0
@@ -1,67 +0,0 @@
1
- import sys
2
- import traceback
3
- from abc import abstractmethod
4
- from typing import Any
5
-
6
- from flask import request
7
- from sapiopylib.rest.User import SapioUser
8
- from sapiopylib.rest.WebhookService import AbstractWebhookHandler
9
- from sapiopylib.rest.pojo.webhook.WebhookResult import SapioWebhookResult
10
-
11
-
12
- class AbstractWebserviceHandler(AbstractWebhookHandler):
13
- """
14
- A base class for constructing "webservice" endpoints on your webhook server. These are endpoints that can be
15
- communicated with by external sources without needing to format the payload JSON in the webhook context format that
16
- webhook handlers expect.
17
-
18
- The entire payload JSON is sent to the run method of this class. It is up to the run method to determine how
19
- this JSON should be parsed. In order to communicate with a Sapio system, a SapioUser object must be able to be
20
- defined using the payload. Functions have been provided for constructing users with various authentication methods.
21
-
22
- Since this extends AbstractWebhookHandler, you can still register endpoints from this class in the same way you
23
- would normal webhook endpoints.
24
- """
25
- def post(self) -> dict[str, Any]:
26
- """
27
- Internal method to be executed to translate incoming requests.
28
- """
29
- # noinspection PyBroadException
30
- try:
31
- return self.run(request.json).to_json()
32
- except Exception:
33
- print('Error occurred while running webservice custom logic. See traceback.', file=sys.stderr)
34
- traceback.print_exc()
35
- return SapioWebhookResult(False, display_text="Error occurred during webservice execution.").to_json()
36
-
37
- @abstractmethod
38
- def run(self, payload: dict[str, Any]) -> SapioWebhookResult:
39
- pass
40
-
41
- def basic_auth(self, url: str, username: str, password: str) -> SapioUser:
42
- """
43
- :param url: The URL of the Sapio system that requests from this user will be sent to.
44
- Must end in /webservice/api
45
- :param username: The username to authenticate requests with.
46
- :param password: The password to authenticate requests with.
47
- :return: A SapioUser that will authenticate requests using basic auth.
48
- """
49
- return SapioUser(url, self.verify_sapio_cert, self.client_timeout_seconds, username=username, password=password)
50
-
51
- def api_token_auth(self, url: str, api_token: str) -> SapioUser:
52
- """
53
- :param url: The URL of the Sapio system that requests from this user will be sent to.
54
- Must end in /webservice/api
55
- :param api_token: The API token to authenticate requests with.
56
- :return: A SapioUser that will authenticate requests using an API token.
57
- """
58
- return SapioUser(url, self.verify_sapio_cert, self.client_timeout_seconds, api_token=api_token)
59
-
60
- def bearer_token_auth(self, url: str, bearer_token: str) -> SapioUser:
61
- """
62
- :param url: The URL of the Sapio system that requests from this user will be sent to.
63
- Must end in /webservice/api
64
- :param bearer_token: The bearer token to authenticate requests with.
65
- :return: A SapioUser that will authenticate requests using a bearer token.
66
- """
67
- return SapioUser(url, self.verify_sapio_cert, self.client_timeout_seconds, bearer_token=bearer_token)
@@ -1,50 +0,0 @@
1
- sapiopycommons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- sapiopycommons/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- sapiopycommons/callbacks/callback_util.py,sha256=UmjRehMkg44LZB-qgOefQogJEcho2xKtHlICegCHe4I,63454
4
- sapiopycommons/chem/IndigoMolecules.py,sha256=QqFDi9CKERj6sn_ZwVcS2xZq4imlkaTeCrpq1iNcEJA,1992
5
- sapiopycommons/chem/Molecules.py,sha256=t80IsQBPJ9mwE8ZxnWomAGrZDhdsOuPvLaTPb_N6jGU,8639
6
- sapiopycommons/chem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- sapiopycommons/customreport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- sapiopycommons/customreport/column_builder.py,sha256=sS_wZYOR72rs3syTNjwCVP4h8M8N0b0burkTxFQItVU,3019
9
- sapiopycommons/customreport/custom_report_builder.py,sha256=o2O89OrWPm0OYS8Ux6EKZTg6hcUzfz3ZxAgnzJg1wEw,6601
10
- sapiopycommons/customreport/term_builder.py,sha256=oVsr7iFPnug2TrZUCcAMhyps-b62kDodPcBxyQeneUY,16763
11
- sapiopycommons/datatype/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- sapiopycommons/datatype/attachment_util.py,sha256=_l2swuP8noIGAl4bwzBUEhr6YlN_OVZl3-gi1XqFHYA,3364
13
- sapiopycommons/eln/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- sapiopycommons/eln/experiment_handler.py,sha256=NoHBthxuXqxdmIj57KEYNqC_t2mArbOkIbcemJkw08U,66683
15
- sapiopycommons/eln/experiment_report_util.py,sha256=B55hXbTGndCEI19LiqhjvO46_chujZUK0qDTWHjzfcU,6398
16
- sapiopycommons/eln/plate_designer.py,sha256=FYJfhhNq8hdfuXgDYOYHy6g0m2zNwQXZWF_MTPzElDg,7184
17
- sapiopycommons/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- sapiopycommons/files/complex_data_loader.py,sha256=T39veNhvYl6j_uZjIIJ8Mk5Aa7otR5RB-g8XlAdkksA,1421
19
- sapiopycommons/files/file_bridge.py,sha256=WwCVegk0OGA8eqho8chsOsLlqg1nXctO75zfh-rHF-g,5950
20
- sapiopycommons/files/file_bridge_handler.py,sha256=bt2IfIsxJ4lcJYo_NHvCQ17ZV6C4fSAEa8Zcgixh7B4,14263
21
- sapiopycommons/files/file_data_handler.py,sha256=SCsjODMJIPEBSsahzXUeOM7CfSCmYwPPoGAM6aOfelo,36743
22
- sapiopycommons/files/file_util.py,sha256=ZrgoGwHHfPdL5KHkGwlrEHJqGpttmZzRkGQCXdLjra8,28284
23
- sapiopycommons/files/file_validator.py,sha256=4OvY98ueJWPJdpndwnKv2nqVvLP9S2W7Il_dM0Y0ojo,28709
24
- sapiopycommons/files/file_writer.py,sha256=96Xl8TTT46Krxe_J8rmmlEMtel4nzZB961f5Yqtl1-I,17616
25
- sapiopycommons/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- sapiopycommons/general/accession_service.py,sha256=HYgyOsH_UaoRnoury-c2yTW8SeG4OtjLemdpCzoV4R8,13484
27
- sapiopycommons/general/aliases.py,sha256=SEC7g218fWkYEcydneAtISgVpP_22YhlI88cM8calWY,10307
28
- sapiopycommons/general/audit_log.py,sha256=tJi4uU4qRY2WWcK4ItkjRvoCHCwwiU9LwCNv4lP5-QQ,8713
29
- sapiopycommons/general/custom_report_util.py,sha256=6Vr3itz5Bav9yBIlblnWMMSc0Mc-HPeVfnpymdLf6fU,15629
30
- sapiopycommons/general/exceptions.py,sha256=DOlLKnpCatxQF-lVCToa8ryJgusWLvip6N_1ALN00QE,1679
31
- sapiopycommons/general/popup_util.py,sha256=vqLSiCry4YClSKIdnk56CIKioBOtawGVmPi2iS1LOIc,31763
32
- sapiopycommons/general/sapio_links.py,sha256=o9Z-8y2rz6AI0Cy6tq58ElPge9RBnisGc9NyccbaJxs,2610
33
- sapiopycommons/general/storage_util.py,sha256=ovmK_jN7v09BoX07XxwShpBUC5WYQOM7dbKV_VeLXJU,8892
34
- sapiopycommons/general/time_util.py,sha256=sXThADCRAQDWYDD9C5CdhcKYIt3qOaVNyZfGBR7HW9A,8701
35
- sapiopycommons/multimodal/multimodal.py,sha256=A1QsC8QTPmgZyPr7KtMbPRedn2Ie4WIErodUvQ9otgU,6724
36
- sapiopycommons/multimodal/multimodal_data.py,sha256=p_caXW0vrURkzDHHspUptEI7lVFpZUrmyF7foz2fAvA,14983
37
- sapiopycommons/processtracking/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- sapiopycommons/processtracking/endpoints.py,sha256=w5bziI2xC7450M95rCF8JpRwkoni1kEDibyAux9B12Q,10848
39
- sapiopycommons/recordmodel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- sapiopycommons/recordmodel/record_handler.py,sha256=Uxjrq6f_cWFbqi7KRLySdOvmQGtbIBrCNyStRewqzx8,64751
41
- sapiopycommons/rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- sapiopycommons/rules/eln_rule_handler.py,sha256=JYzDA_14D2nLnlqwbpIxVOrfKWzbOS27AYf4TQfGr4Q,10469
43
- sapiopycommons/rules/on_save_rule_handler.py,sha256=Rkqvph20RbNq6m-RF4fbvCP-YfD2CZYBM2iTr3nl0eY,10236
44
- sapiopycommons/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- sapiopycommons/webhook/webhook_handlers.py,sha256=jwc4xu-wwl8haS5k1dENZ1UIYK9GQk74TAo3CGxMW9U,16583
46
- sapiopycommons/webhook/webservice_handlers.py,sha256=1J56zFI0pWl5MHoNTznvcZumITXgAHJMluj8-2BqYEw,3315
47
- sapiopycommons-2024.8.27a310.dist-info/METADATA,sha256=nAfS7nEAT9ciLMIelSBvSpHoj6BzQ5o8qYKktJYtOvo,3176
48
- sapiopycommons-2024.8.27a310.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
49
- sapiopycommons-2024.8.27a310.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
50
- sapiopycommons-2024.8.27a310.dist-info/RECORD,,