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
50 51 52 53 54 55 56 57 58 59 60 61 | |
S3Credentials
dataclass
S3 object storage credentials.
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
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
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
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
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
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
64 65 66 67 68 69 70 71 72 73 74 75 76 | |
read_streaming_response(response)
async
Read a json-formatted streaming response content
Source code in docs/rs-server/services/common/rs_server_common/utils/utils2.py
79 80 81 82 83 84 85 86 87 88 89 90 91 | |