| 1071 | |
| 1072 | @final |
| 1073 | class FinalRequestOptions(pydantic.BaseModel): |
| 1074 | method: str |
| 1075 | url: str |
| 1076 | params: Query = {} |
| 1077 | headers: Union[Headers, NotGiven] = NotGiven() |
| 1078 | max_retries: Union[int, NotGiven] = NotGiven() |
| 1079 | timeout: Union[float, Timeout, None, NotGiven] = NotGiven() |
| 1080 | files: Union[HttpxRequestFiles, None] = None |
| 1081 | idempotency_key: Union[str, None] = None |
| 1082 | post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() |
| 1083 | follow_redirects: Union[bool, None] = None |
| 1084 | # The query pairs that tell the operation apart from the others with its path in the OpenAPI |
| 1085 | # document. Set by the SDK method that makes the API call. Not a public option. |
| 1086 | qualifiers: Optional[dict[str, str]] = None |
| 1087 | # Set by the SDK method that makes the API call, for the call's span. Not public options. |
| 1088 | span_name: Optional[str] = None |
| 1089 | span_route: Optional[str] = None |
| 1090 | span_query_params: Tuple[str, ...] = () |
| 1091 | # The query parameters that are content on this endpoint only. |
| 1092 | span_content_query_params: Tuple[str, ...] = () |
| 1093 | span_attributes: Union[Mapping[str, AttributeValue], Callable[[object], Mapping[str, AttributeValue]], None] = None |
| 1094 | span_created_id: Union[str, Tuple[str, str], None] = None |
| 1095 | |
| 1096 | content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None |
| 1097 | # It should be noted that we cannot use `json` here as that would override |
| 1098 | # a BaseModel method in an incompatible fashion. |
| 1099 | json_data: Union[Body, None] = None |
| 1100 | extra_json: Union[AnyMapping, None] = None |
| 1101 | |
| 1102 | if PYDANTIC_V1: |
| 1103 | |
| 1104 | class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] |
| 1105 | arbitrary_types_allowed: bool = True |
| 1106 | else: |
| 1107 | model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) |
| 1108 | |
| 1109 | def get_max_retries(self, max_retries: int) -> int: |
| 1110 | if isinstance(self.max_retries, NotGiven): |
| 1111 | return max_retries |
| 1112 | return self.max_retries |
| 1113 | |
| 1114 | def _strip_raw_response_header(self) -> None: |
| 1115 | if not is_given(self.headers): |
| 1116 | return |
| 1117 | |
| 1118 | if self.headers.get(RAW_RESPONSE_HEADER): |
| 1119 | self.headers = {**self.headers} |
| 1120 | self.headers.pop(RAW_RESPONSE_HEADER) |
| 1121 | |
| 1122 | # override the `construct` method so that we can run custom transformations. |
| 1123 | # this is necessary as we don't want to do any actual runtime type checking |
| 1124 | # (which means we can't use validators) but we do want to ensure that `NotGiven` |
| 1125 | # values are not present |
| 1126 | # |
| 1127 | # type ignore required because we're adding explicit types to `**values` |
| 1128 | @classmethod |
| 1129 | def construct( # type: ignore |
| 1130 | cls, |