Source code for azure.cosmos._cosmos_responses
# The MIT License (MIT)
# Copyright (c) 2024 Microsoft Corporation
from typing import Any, Dict, Iterable, Mapping, Optional, List
from azure.core.utils import CaseInsensitiveDict
[docs]
class CosmosDict(Dict[str, Any]):
def __init__(self, original_dict: Optional[Mapping[str, Any]], /, *, response_headers: CaseInsensitiveDict) -> None:
if original_dict is None:
original_dict = {}
super().__init__(original_dict)
self._response_headers = response_headers
[docs]
def get_response_headers(self) -> CaseInsensitiveDict:
"""Returns a copy of the response headers associated to this response
:return: Dict of response headers
:rtype: ~azure.core.CaseInsensitiveDict
"""
return self._response_headers.copy()
[docs]
class CosmosList(List[Dict[str, Any]]):
def __init__(self, original_list: Optional[Iterable[Dict[str, Any]]], /, *,
response_headers: CaseInsensitiveDict) -> None:
if original_list is None:
original_list = []
super().__init__(original_list)
self._response_headers = response_headers
[docs]
def get_response_headers(self) -> CaseInsensitiveDict:
"""Returns a copy of the response headers associated to this response
:return: Dict of response headers
:rtype: ~azure.core.CaseInsensitiveDict
"""
return self._response_headers.copy()