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,
)
| 1812 | |
| 1813 | |
| 1814 | def make_request_options( |
| 1815 | *, |
| 1816 | query: Query | None = None, |
| 1817 | extra_headers: Headers | None = None, |
| 1818 | extra_query: Query | None = None, |
| 1819 | extra_body: Body | None = None, |
| 1820 | idempotency_key: str | None = None, |
| 1821 | timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 1822 | post_parser: PostParser | NotGiven = NOT_GIVEN, |
| 1823 | ) -> RequestOptions: |
| 1824 | """Create a dict of type RequestOptions without keys of NotGiven values.""" |
| 1825 | options: RequestOptions = {} |
| 1826 | if extra_headers is not None: |
| 1827 | options["headers"] = extra_headers |
| 1828 | |
| 1829 | if extra_body is not None: |
| 1830 | options["extra_json"] = cast(AnyMapping, extra_body) |
| 1831 | |
| 1832 | if query is not None: |
| 1833 | options["params"] = query |
| 1834 | |
| 1835 | if extra_query is not None: |
| 1836 | options["params"] = {**options.get("params", {}), **extra_query} |
| 1837 | |
| 1838 | if not isinstance(timeout, NotGiven): |
| 1839 | options["timeout"] = timeout |
| 1840 | |
| 1841 | if idempotency_key is not None: |
| 1842 | options["idempotency_key"] = idempotency_key |
| 1843 | |
| 1844 | if is_given(post_parser): |
| 1845 | # internal |
| 1846 | options["post_parser"] = post_parser # type: ignore |
| 1847 | |
| 1848 | return options |
| 1849 | |
| 1850 | |
| 1851 | class ForceMultipartDict(Dict[str, None]): |