everysk-lib 1.10.2__cp312-cp312-win_amd64.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.
- everysk/__init__.py +30 -0
- everysk/_version.py +683 -0
- everysk/api/__init__.py +61 -0
- everysk/api/api_requestor.py +167 -0
- everysk/api/api_resources/__init__.py +23 -0
- everysk/api/api_resources/api_resource.py +371 -0
- everysk/api/api_resources/calculation.py +779 -0
- everysk/api/api_resources/custom_index.py +42 -0
- everysk/api/api_resources/datastore.py +81 -0
- everysk/api/api_resources/file.py +42 -0
- everysk/api/api_resources/market_data.py +223 -0
- everysk/api/api_resources/parser.py +66 -0
- everysk/api/api_resources/portfolio.py +43 -0
- everysk/api/api_resources/private_security.py +42 -0
- everysk/api/api_resources/report.py +65 -0
- everysk/api/api_resources/report_template.py +39 -0
- everysk/api/api_resources/tests.py +115 -0
- everysk/api/api_resources/worker_execution.py +64 -0
- everysk/api/api_resources/workflow.py +65 -0
- everysk/api/api_resources/workflow_execution.py +93 -0
- everysk/api/api_resources/workspace.py +42 -0
- everysk/api/http_client.py +63 -0
- everysk/api/tests.py +32 -0
- everysk/api/utils.py +262 -0
- everysk/config.py +451 -0
- everysk/core/_tests/serialize/test_json.py +336 -0
- everysk/core/_tests/serialize/test_orjson.py +295 -0
- everysk/core/_tests/serialize/test_pickle.py +48 -0
- everysk/core/cloud_function/main.py +78 -0
- everysk/core/cloud_function/tests.py +86 -0
- everysk/core/compress.py +245 -0
- everysk/core/datetime/__init__.py +12 -0
- everysk/core/datetime/calendar.py +144 -0
- everysk/core/datetime/date.py +424 -0
- everysk/core/datetime/date_expression.py +299 -0
- everysk/core/datetime/date_mixin.py +1475 -0
- everysk/core/datetime/date_settings.py +30 -0
- everysk/core/datetime/datetime.py +713 -0
- everysk/core/exceptions.py +435 -0
- everysk/core/fields.py +1176 -0
- everysk/core/firestore.py +555 -0
- everysk/core/fixtures/_settings.py +29 -0
- everysk/core/fixtures/other/_settings.py +18 -0
- everysk/core/fixtures/user_agents.json +88 -0
- everysk/core/http.py +691 -0
- everysk/core/lists.py +92 -0
- everysk/core/log.py +709 -0
- everysk/core/number.py +37 -0
- everysk/core/object.py +1469 -0
- everysk/core/redis.py +1021 -0
- everysk/core/retry.py +51 -0
- everysk/core/serialize.py +674 -0
- everysk/core/sftp.py +414 -0
- everysk/core/signing.py +53 -0
- everysk/core/slack.py +127 -0
- everysk/core/string.py +199 -0
- everysk/core/tests.py +240 -0
- everysk/core/threads.py +199 -0
- everysk/core/undefined.py +70 -0
- everysk/core/unittests.py +73 -0
- everysk/core/workers.py +241 -0
- everysk/sdk/__init__.py +23 -0
- everysk/sdk/base.py +98 -0
- everysk/sdk/brutils/cnpj.py +391 -0
- everysk/sdk/brutils/cnpj_pd.py +129 -0
- everysk/sdk/engines/__init__.py +26 -0
- everysk/sdk/engines/cache.py +185 -0
- everysk/sdk/engines/compliance.py +37 -0
- everysk/sdk/engines/cryptography.py +69 -0
- everysk/sdk/engines/expression.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/expression.pyi +55 -0
- everysk/sdk/engines/helpers.cp312-win_amd64.pyd +0 -0
- everysk/sdk/engines/helpers.pyi +26 -0
- everysk/sdk/engines/lock.py +120 -0
- everysk/sdk/engines/market_data.py +244 -0
- everysk/sdk/engines/settings.py +19 -0
- everysk/sdk/entities/__init__.py +23 -0
- everysk/sdk/entities/base.py +784 -0
- everysk/sdk/entities/base_list.py +131 -0
- everysk/sdk/entities/custom_index/base.py +209 -0
- everysk/sdk/entities/custom_index/settings.py +29 -0
- everysk/sdk/entities/datastore/base.py +160 -0
- everysk/sdk/entities/datastore/settings.py +17 -0
- everysk/sdk/entities/fields.py +375 -0
- everysk/sdk/entities/file/base.py +215 -0
- everysk/sdk/entities/file/settings.py +63 -0
- everysk/sdk/entities/portfolio/base.py +248 -0
- everysk/sdk/entities/portfolio/securities.py +241 -0
- everysk/sdk/entities/portfolio/security.py +580 -0
- everysk/sdk/entities/portfolio/settings.py +97 -0
- everysk/sdk/entities/private_security/base.py +226 -0
- everysk/sdk/entities/private_security/settings.py +17 -0
- everysk/sdk/entities/query.py +603 -0
- everysk/sdk/entities/report/base.py +214 -0
- everysk/sdk/entities/report/settings.py +23 -0
- everysk/sdk/entities/script.py +310 -0
- everysk/sdk/entities/secrets/base.py +128 -0
- everysk/sdk/entities/secrets/script.py +119 -0
- everysk/sdk/entities/secrets/settings.py +17 -0
- everysk/sdk/entities/settings.py +48 -0
- everysk/sdk/entities/tags.py +174 -0
- everysk/sdk/entities/worker_execution/base.py +307 -0
- everysk/sdk/entities/worker_execution/settings.py +63 -0
- everysk/sdk/entities/workflow_execution/base.py +113 -0
- everysk/sdk/entities/workflow_execution/settings.py +32 -0
- everysk/sdk/entities/workspace/base.py +99 -0
- everysk/sdk/entities/workspace/settings.py +27 -0
- everysk/sdk/settings.py +67 -0
- everysk/sdk/tests.py +105 -0
- everysk/sdk/worker_base.py +47 -0
- everysk/server/__init__.py +9 -0
- everysk/server/applications.py +63 -0
- everysk/server/endpoints.py +516 -0
- everysk/server/example_api.py +69 -0
- everysk/server/middlewares.py +80 -0
- everysk/server/requests.py +62 -0
- everysk/server/responses.py +119 -0
- everysk/server/routing.py +64 -0
- everysk/server/settings.py +36 -0
- everysk/server/tests.py +36 -0
- everysk/settings.py +98 -0
- everysk/sql/__init__.py +9 -0
- everysk/sql/connection.py +232 -0
- everysk/sql/model.py +376 -0
- everysk/sql/query.py +417 -0
- everysk/sql/row_factory.py +63 -0
- everysk/sql/settings.py +49 -0
- everysk/sql/utils.py +129 -0
- everysk/tests.py +23 -0
- everysk/utils.py +81 -0
- everysk/version.py +15 -0
- everysk_lib-1.10.2.dist-info/.gitignore +5 -0
- everysk_lib-1.10.2.dist-info/METADATA +326 -0
- everysk_lib-1.10.2.dist-info/RECORD +137 -0
- everysk_lib-1.10.2.dist-info/WHEEL +5 -0
- everysk_lib-1.10.2.dist-info/licenses/LICENSE.txt +9 -0
- everysk_lib-1.10.2.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# (C) Copyright 2023 EVERYSK TECHNOLOGIES
|
|
4
|
+
#
|
|
5
|
+
# This is an unpublished work containing confidential and proprietary
|
|
6
|
+
# information of EVERYSK TECHNOLOGIES. Disclosure, use, or reproduction
|
|
7
|
+
# without authorization of EVERYSK TECHNOLOGIES is prohibited.
|
|
8
|
+
#
|
|
9
|
+
###############################################################################
|
|
10
|
+
|
|
11
|
+
###############################################################################
|
|
12
|
+
# _BaseException Class Implementation
|
|
13
|
+
###############################################################################
|
|
14
|
+
class _BaseException(Exception):
|
|
15
|
+
"""
|
|
16
|
+
Inherits from 'Exception' and adds its own features
|
|
17
|
+
|
|
18
|
+
Custom Base Exception that will generate an attribute called msg
|
|
19
|
+
with the error message and will be used to catch errors.
|
|
20
|
+
"""
|
|
21
|
+
## Private attributes
|
|
22
|
+
_args: tuple = None
|
|
23
|
+
|
|
24
|
+
## Public attributes
|
|
25
|
+
msg: str = 'Application error.'
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
@property
|
|
29
|
+
def args(self) -> tuple:
|
|
30
|
+
""" Keeps the args attribute in sync with the msg attribute. """
|
|
31
|
+
return self._args
|
|
32
|
+
|
|
33
|
+
@args.setter
|
|
34
|
+
def args(self, value: tuple) -> None:
|
|
35
|
+
"""
|
|
36
|
+
Used to keep sync the args and the msg attribute.
|
|
37
|
+
|
|
38
|
+
Raises:
|
|
39
|
+
ValueError: If `value` in not a tuple.
|
|
40
|
+
"""
|
|
41
|
+
if not isinstance(value, tuple):
|
|
42
|
+
raise ValueError(f"The 'args' value must be a tuple not {type(value)}.")
|
|
43
|
+
|
|
44
|
+
self.msg = value[0]
|
|
45
|
+
self._args = value
|
|
46
|
+
|
|
47
|
+
## Methods
|
|
48
|
+
def __init__(self, *args: list, **kwargs: dict) -> None:
|
|
49
|
+
super().__init__(*args)
|
|
50
|
+
if len(args) == 1:
|
|
51
|
+
self.msg = args[0]
|
|
52
|
+
|
|
53
|
+
if kwargs:
|
|
54
|
+
for attr, value in kwargs.items():
|
|
55
|
+
setattr(self, attr, value)
|
|
56
|
+
|
|
57
|
+
def __str__(self):
|
|
58
|
+
return f'{self.msg}'
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
###############################################################################
|
|
62
|
+
# HandledException Class Implementation
|
|
63
|
+
###############################################################################
|
|
64
|
+
class HandledException(_BaseException):
|
|
65
|
+
"""
|
|
66
|
+
Custom exception class for handling specific errors.
|
|
67
|
+
|
|
68
|
+
This exception class inherits from _BaseException and is intended to handle errors related to specific operations or conditions.
|
|
69
|
+
|
|
70
|
+
Attributes:
|
|
71
|
+
message (str): An optional message providing additional details about the error.
|
|
72
|
+
|
|
73
|
+
Example:
|
|
74
|
+
To raise a HandledException:
|
|
75
|
+
>>> raise HandledException('An error occurred.')
|
|
76
|
+
"""
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
###############################################################################
|
|
81
|
+
# APIError Class Implementation
|
|
82
|
+
###############################################################################
|
|
83
|
+
class APIError(HandledException):
|
|
84
|
+
# pylint: disable=import-outside-toplevel
|
|
85
|
+
"""
|
|
86
|
+
Exception class used to raise any error
|
|
87
|
+
that is related to API responses or requests.
|
|
88
|
+
|
|
89
|
+
It can be raised when a request failed or the
|
|
90
|
+
response did not return the correct code or data.
|
|
91
|
+
|
|
92
|
+
Example:
|
|
93
|
+
To raise an APIError exception:
|
|
94
|
+
>>> raise APIError(code, response)
|
|
95
|
+
"""
|
|
96
|
+
def __init__(self, code, message) -> None:
|
|
97
|
+
from everysk.core.serialize import loads
|
|
98
|
+
super().__init__(message)
|
|
99
|
+
self.__code = code
|
|
100
|
+
self.__message = loads(message, protocol='json') if message else message
|
|
101
|
+
|
|
102
|
+
def __str__(self):
|
|
103
|
+
"""
|
|
104
|
+
The string representation of the APIError
|
|
105
|
+
exception class.
|
|
106
|
+
"""
|
|
107
|
+
from everysk.core.serialize import dumps
|
|
108
|
+
if self.__code and self.__message:
|
|
109
|
+
return dumps(self.__message, sort_keys=True, indent=2, protocol='json')
|
|
110
|
+
return 'API ERROR'
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
###############################################################################
|
|
114
|
+
# DateError Class Implementation
|
|
115
|
+
###############################################################################
|
|
116
|
+
class DateError(HandledException):
|
|
117
|
+
"""
|
|
118
|
+
Custom exception class for date-related errors
|
|
119
|
+
|
|
120
|
+
This exception class inherits from HandledException and is used to handle errors related to date operations.
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
To raise a DateError exception:
|
|
124
|
+
>>> raise DateError('Invalid date format.')
|
|
125
|
+
"""
|
|
126
|
+
pass
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
###############################################################################
|
|
130
|
+
# DefaultError Class Implementation
|
|
131
|
+
###############################################################################
|
|
132
|
+
class DefaultError(HandledException):
|
|
133
|
+
"""
|
|
134
|
+
Custom exception class for default errors.
|
|
135
|
+
This exception class inherits from HandledException and serves as a generic
|
|
136
|
+
error class for handling default or unspecified errors.
|
|
137
|
+
|
|
138
|
+
Example:
|
|
139
|
+
To raise a DefaultError exception:
|
|
140
|
+
>>> raise DefaultError('An error occurred.')
|
|
141
|
+
"""
|
|
142
|
+
pass
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
###############################################################################
|
|
146
|
+
# EntityError Class Implementation
|
|
147
|
+
###############################################################################
|
|
148
|
+
class EntityError(HandledException):
|
|
149
|
+
"""
|
|
150
|
+
Exception class designed to handle
|
|
151
|
+
errors related to entity operations,
|
|
152
|
+
such as creating, deleting, or inserting.
|
|
153
|
+
|
|
154
|
+
Example:
|
|
155
|
+
To raise an EntityError exception:
|
|
156
|
+
>>> raise EntityError(f'Error in delete entity. {entity.id}.')
|
|
157
|
+
"""
|
|
158
|
+
pass
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
###############################################################################
|
|
162
|
+
# EntityNotFound Class Implementation
|
|
163
|
+
###############################################################################
|
|
164
|
+
class EntityNotFound(HandledException):
|
|
165
|
+
"""
|
|
166
|
+
Class used to raise exceptions for
|
|
167
|
+
when some entity is not found.
|
|
168
|
+
|
|
169
|
+
It can be used when we try to
|
|
170
|
+
update an entity that does not exist.
|
|
171
|
+
|
|
172
|
+
Example:
|
|
173
|
+
To raise an EntityNotFound exception:
|
|
174
|
+
>>> raise EntityNotFound(f'Entity not found for update. Entity ID: {entity_id}.')
|
|
175
|
+
"""
|
|
176
|
+
pass
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
###############################################################################
|
|
180
|
+
# FieldValueError Class Implementation
|
|
181
|
+
###############################################################################
|
|
182
|
+
class FieldValueError(HandledException, ValueError):
|
|
183
|
+
"""
|
|
184
|
+
Custom exception class for field value erros.
|
|
185
|
+
This exception class inherits from both HandledException and ValueError.
|
|
186
|
+
It is used to handle errors related to invalid field values.
|
|
187
|
+
|
|
188
|
+
Example:
|
|
189
|
+
To raise a FieldValueError exception:
|
|
190
|
+
>>> raise FieldValueError('Invalid field value.')
|
|
191
|
+
"""
|
|
192
|
+
pass
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
###############################################################################
|
|
196
|
+
# HttpError Class Implementation
|
|
197
|
+
###############################################################################
|
|
198
|
+
class HttpError(HandledException):
|
|
199
|
+
"""
|
|
200
|
+
Exception class used to raise errors
|
|
201
|
+
related to HTTP requests.
|
|
202
|
+
|
|
203
|
+
It's implementation can be justified
|
|
204
|
+
for occasions when the status code is
|
|
205
|
+
not successful after a response.
|
|
206
|
+
|
|
207
|
+
Example:
|
|
208
|
+
To raise a HttpError exception:
|
|
209
|
+
>>> raise HttpError(status_code=response.status_code, msg=response.content)
|
|
210
|
+
"""
|
|
211
|
+
status_code: int = 500
|
|
212
|
+
|
|
213
|
+
def __str__(self):
|
|
214
|
+
"""
|
|
215
|
+
Returns a string representation of the
|
|
216
|
+
response containing the status code
|
|
217
|
+
followed by the content.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
str: The string representation of the response object.
|
|
221
|
+
"""
|
|
222
|
+
return f'{self.status_code} -> {self.msg}'
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
###############################################################################
|
|
226
|
+
# InvalidArgumentError Class Implementation
|
|
227
|
+
###############################################################################
|
|
228
|
+
class InvalidArgumentError(HandledException):
|
|
229
|
+
"""
|
|
230
|
+
This class can be used to raise exceptions
|
|
231
|
+
for times when we have an incorrect argument
|
|
232
|
+
or attribute of an object.
|
|
233
|
+
|
|
234
|
+
Example:
|
|
235
|
+
To raise an InvalidArgumentError exception:
|
|
236
|
+
>>> raise InvalidArgumentError('Invalid API SID.')
|
|
237
|
+
"""
|
|
238
|
+
pass
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
###############################################################################
|
|
242
|
+
# QueryError Class Implementation
|
|
243
|
+
###############################################################################
|
|
244
|
+
class QueryError(HandledException):
|
|
245
|
+
"""
|
|
246
|
+
Exception class used inside the
|
|
247
|
+
`Query` entity to raise errors for
|
|
248
|
+
invalid queries.
|
|
249
|
+
|
|
250
|
+
Example:
|
|
251
|
+
To raise a QueryError exception:
|
|
252
|
+
>>> raise QueryError('No entity found matching the query.')
|
|
253
|
+
"""
|
|
254
|
+
pass
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
###############################################################################
|
|
258
|
+
# ReadonlyError Class Implementation
|
|
259
|
+
###############################################################################
|
|
260
|
+
class ReadonlyError(HandledException):
|
|
261
|
+
"""
|
|
262
|
+
Exception class designed to raise
|
|
263
|
+
errors when we try to alter a field
|
|
264
|
+
that cannot be modified.
|
|
265
|
+
|
|
266
|
+
Example:
|
|
267
|
+
To raise a ReadonlyError exception:
|
|
268
|
+
>>> raise ReadonlyError('This field value cannot be modified.')
|
|
269
|
+
"""
|
|
270
|
+
pass
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
###############################################################################
|
|
274
|
+
# RedisEmptyListError Class Implementation
|
|
275
|
+
###############################################################################
|
|
276
|
+
class RedisEmptyListError(HandledException):
|
|
277
|
+
"""
|
|
278
|
+
Exception raise in cases where we might
|
|
279
|
+
try to modify a Redis list and the list
|
|
280
|
+
is actually empty.
|
|
281
|
+
|
|
282
|
+
Example:
|
|
283
|
+
To raise a RedisEmptyListError exception:
|
|
284
|
+
>>> raise RedisEmptyListError(f"The RedisList(name='{self.name}') is empty.")
|
|
285
|
+
"""
|
|
286
|
+
pass
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
###############################################################################
|
|
290
|
+
# RequiredError Class Implementation
|
|
291
|
+
###############################################################################
|
|
292
|
+
class RequiredError(HandledException):
|
|
293
|
+
"""
|
|
294
|
+
Exception class implemented with the goal
|
|
295
|
+
of raising an error when a specified field
|
|
296
|
+
or an attribute is required.
|
|
297
|
+
|
|
298
|
+
Example:
|
|
299
|
+
To raise a RequiredError exception:
|
|
300
|
+
>>> raise RequiredError('The attribute is required.')
|
|
301
|
+
"""
|
|
302
|
+
pass
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
###############################################################################
|
|
306
|
+
# SDKError Class Implementation
|
|
307
|
+
###############################################################################
|
|
308
|
+
class SDKError(HandledException):
|
|
309
|
+
"""
|
|
310
|
+
Exception class designed to raise
|
|
311
|
+
errors that are, overall, related to
|
|
312
|
+
the Everysk SDK and the creation of
|
|
313
|
+
entities.
|
|
314
|
+
|
|
315
|
+
For instance, we might raise a `SDKError`
|
|
316
|
+
when trying to creating an entity that
|
|
317
|
+
already exists.
|
|
318
|
+
|
|
319
|
+
Example:
|
|
320
|
+
To raise a SDKError exception:
|
|
321
|
+
>>> raise SDKError('Entity already exists. ID: {entity.id}.')
|
|
322
|
+
"""
|
|
323
|
+
pass
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
###############################################################################
|
|
327
|
+
# SDKInternalError Class Implementation
|
|
328
|
+
###############################################################################
|
|
329
|
+
class SDKInternalError(_BaseException):
|
|
330
|
+
"""
|
|
331
|
+
Exception class designed to raise
|
|
332
|
+
errors that are internal to
|
|
333
|
+
the Everysk SDK and the creation of
|
|
334
|
+
entities.
|
|
335
|
+
|
|
336
|
+
Example:
|
|
337
|
+
To raise a SDKInternalError exception:
|
|
338
|
+
>>> raise SDKInternalError('Internal Server Error.')
|
|
339
|
+
"""
|
|
340
|
+
pass
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
###############################################################################
|
|
344
|
+
# SDKTypeError Class Implementation
|
|
345
|
+
###############################################################################
|
|
346
|
+
class SDKTypeError(HandledException, TypeError):
|
|
347
|
+
"""
|
|
348
|
+
Internal class used to catch type errors
|
|
349
|
+
related to the Everysk SDK.
|
|
350
|
+
|
|
351
|
+
This class is used in cases where we have
|
|
352
|
+
an incorrect data type for an argument in
|
|
353
|
+
a function. In other words, passing an integer
|
|
354
|
+
where it should be a string.
|
|
355
|
+
|
|
356
|
+
Example:
|
|
357
|
+
To raise a SDKTypeError exception:
|
|
358
|
+
>>> raise SDKTypeError('The tags value must be a string or a list of strings.')
|
|
359
|
+
"""
|
|
360
|
+
pass
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
###############################################################################
|
|
364
|
+
# SDKValueError Class Implementation
|
|
365
|
+
###############################################################################
|
|
366
|
+
class SDKValueError(HandledException, ValueError):
|
|
367
|
+
"""
|
|
368
|
+
Class used to catch value errors that are
|
|
369
|
+
related to the Everysk SDK.
|
|
370
|
+
|
|
371
|
+
Mostly used when we have incorrect values
|
|
372
|
+
as arguments to a function.
|
|
373
|
+
|
|
374
|
+
Example:
|
|
375
|
+
To raise a SDKValueError exception:
|
|
376
|
+
>>> raise SDKValueError(f"Filter by {property_name} operator must be '='.")
|
|
377
|
+
"""
|
|
378
|
+
pass
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
###############################################################################
|
|
382
|
+
# SigningError Class Implementation
|
|
383
|
+
###############################################################################
|
|
384
|
+
class SigningError(_BaseException):
|
|
385
|
+
"""
|
|
386
|
+
Exception class used to raise errors related to unsign operations.
|
|
387
|
+
|
|
388
|
+
Example:
|
|
389
|
+
>>> from everysk.core.signing import unsign
|
|
390
|
+
>>> unsign(b'a:a')
|
|
391
|
+
---------------------------------------------------------------------------
|
|
392
|
+
SigningError Traceback (most recent call last)
|
|
393
|
+
Cell In[2], line 1
|
|
394
|
+
----> 1 unsign(b'a:a')
|
|
395
|
+
|
|
396
|
+
File /var/app/src/everysk/core/signing.py:50, in unsign(signed_data, hash_name)
|
|
397
|
+
47 if hmac.compare_digest(digest, hmac.new(SIGNING_KEY, data, hash_name).hexdigest().encode()):
|
|
398
|
+
48 return data
|
|
399
|
+
---> 50 raise SigningError('Error trying to unsign data.')
|
|
400
|
+
|
|
401
|
+
SigningError: Error trying to unsign data.
|
|
402
|
+
"""
|
|
403
|
+
msg: str = 'Error trying to unsign data.'
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
###############################################################################
|
|
407
|
+
# DataOpsError Class Implementation
|
|
408
|
+
###############################################################################
|
|
409
|
+
class DataOpsError(HandledException):
|
|
410
|
+
"""
|
|
411
|
+
Exception class designed to raise
|
|
412
|
+
errors related to Data Operations
|
|
413
|
+
engine inside the application.
|
|
414
|
+
|
|
415
|
+
Example:
|
|
416
|
+
To raise a DataOpsError exception:
|
|
417
|
+
>>> raise DataOpsError('Data Operation error.')
|
|
418
|
+
"""
|
|
419
|
+
pass
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
###############################################################################
|
|
423
|
+
# WorkerError Class Implementation
|
|
424
|
+
###############################################################################
|
|
425
|
+
class WorkerError(HandledException):
|
|
426
|
+
"""
|
|
427
|
+
Exception class designed to raise
|
|
428
|
+
errors related to Workers inside
|
|
429
|
+
the application.
|
|
430
|
+
|
|
431
|
+
Example:
|
|
432
|
+
To raise a WorkerError exception:
|
|
433
|
+
>>> raise WorkerError('Worker error.')
|
|
434
|
+
"""
|
|
435
|
+
pass
|