Create a dict of type RequestOptions without keys of NotGiven values.
(
*,
query: Query | None = None,
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
idempotency_key: str | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
post_parser: PostParser | NotGiven = not_given,
)
| 2368 | |
| 2369 | |
| 2370 | def make_request_options( |
| 2371 | *, |
| 2372 | query: Query | None = None, |
| 2373 | extra_headers: Headers | None = None, |
| 2374 | extra_query: Query | None = None, |
| 2375 | extra_body: Body | None = None, |
| 2376 | idempotency_key: str | None = None, |
| 2377 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 2378 | post_parser: PostParser | NotGiven = not_given, |
| 2379 | ) -> RequestOptions: |
| 2380 | """Create a dict of type RequestOptions without keys of NotGiven values.""" |
| 2381 | options: RequestOptions = {} |
| 2382 | if extra_headers is not None: |
| 2383 | options["headers"] = extra_headers |
| 2384 | |
| 2385 | if extra_body is not None: |
| 2386 | options["extra_json"] = cast(AnyMapping, extra_body) |
| 2387 | |
| 2388 | if query is not None: |
| 2389 | options["params"] = query |
| 2390 | |
| 2391 | if extra_query is not None: |
| 2392 | options["params"] = {**options.get("params", {}), **extra_query} |
| 2393 | |
| 2394 | if not isinstance(timeout, NotGiven): |
| 2395 | options["timeout"] = timeout |
| 2396 | |
| 2397 | if idempotency_key is not None: |
| 2398 | options["idempotency_key"] = idempotency_key |
| 2399 | |
| 2400 | if is_given(post_parser): |
| 2401 | # internal |
| 2402 | options["post_parser"] = post_parser # type: ignore |
| 2403 | |
| 2404 | return options |
| 2405 | |
| 2406 | |
| 2407 | class ForceMultipartDict(Dict[str, None]): |