Write a JSON object. Pass if_match= for an optimistic-concurrency write, or if_none_match="*" to fail if the key already exists. Raises PreconditionFailed when the condition is not met.
(
key: str,
data: dict,
if_match: Optional[str] = None,
if_none_match: Optional[str] = None,
)
| 127 | |
| 128 | |
| 129 | async def put_json( |
| 130 | key: str, |
| 131 | data: dict, |
| 132 | if_match: Optional[str] = None, |
| 133 | if_none_match: Optional[str] = None, |
| 134 | ) -> str: |
| 135 | """ |
| 136 | Write a JSON object. Pass if_match=<etag> for an optimistic-concurrency |
| 137 | write, or if_none_match="*" to fail if the key already exists. |
| 138 | |
| 139 | Raises PreconditionFailed when the condition is not met. |
| 140 | """ |
| 141 | return await asyncio.to_thread(_put_json_sync, key, data, if_match, if_none_match) |
| 142 | |
| 143 | |
| 144 | async def put_bytes( |