Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/ogx_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import os
import json
from typing import TYPE_CHECKING, Any, Mapping
from typing_extensions import Self, override

Expand Down Expand Up @@ -112,6 +113,7 @@ def __init__(
# outlining your use-case to help us decide if it should be
# part of our public interface in the future.
_strict_response_validation: bool = False,
provider_data: Mapping[str, Any] | None = None,
) -> None:
"""Construct a new synchronous OgxClient client instance.

Expand All @@ -135,6 +137,12 @@ def __init__(
parsed[line[:colon].strip()] = line[colon + 1 :].strip()
default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}

if provider_data is not None:
default_headers = {
**(default_headers if is_mapping_t(default_headers) else {}),
"X-OGX-Provider-Data": json.dumps(provider_data),
}

super().__init__(
version=__version__,
base_url=base_url,
Expand Down Expand Up @@ -436,6 +444,7 @@ def __init__(
# outlining your use-case to help us decide if it should be
# part of our public interface in the future.
_strict_response_validation: bool = False,
provider_data: Mapping[str, Any] | None = None,
) -> None:
"""Construct a new async AsyncOgxClient client instance.

Expand All @@ -459,6 +468,12 @@ def __init__(
parsed[line[:colon].strip()] = line[colon + 1 :].strip()
default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})}

if provider_data is not None:
default_headers = {
**(default_headers if is_mapping_t(default_headers) else {}),
"X-OGX-Provider-Data": json.dumps(provider_data),
}

super().__init__(
version=__version__,
base_url=base_url,
Expand Down
Loading