rs_server_common/utils/utils2.md
This module is used to share common functions between apis endpoints. Split it from utils.py because of dependency conflicts between rs-server-catalog and rs-server-common.
AuthInfo
dataclass
User authentication information in KeyCloak.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
decorate_sync_async(decorating_context, func)
Decorator for both sync and async functions, see: https://stackoverflow.com/a/68746329
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
filelock(func, env_var)
Avoid concurrent writing to the database using a file lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_var
|
str
|
environment variable that defines the folder where to save the lock file. |
required |
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
log_http_exception(logger, status_code, detail=None, headers=None, exception_type=HTTPException)
Log error and return an HTTP exception to be raised by the caller
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
read_response_error(response)
Read and return an HTTP response error detail.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
80 81 82 83 84 85 86 87 88 89 90 91 92 | |