Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accepting client_id header #76

Merged
merged 20 commits into from
Feb 2, 2024
12 changes: 9 additions & 3 deletions sdk/python/feast/infra/registry/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class HttpRegistryConfig(RegistryConfig):
""" str: Endpoint of Feature registry.
If registry_type is 'http', then this is a endpoint of Feature Registry """

client_id: Optional[StrictStr] = "Unknown"


CACHE_REFRESH_THRESHOLD_SECONDS = 300

Expand All @@ -77,10 +79,13 @@ def __init__(
timeout = httpx.Timeout(5.0, connect=60.0)
transport = httpx.HTTPTransport(retries=3, verify=False)
self.base_url = registry_config.path
headers = [
("Content-Type", "application/json"),
("Client-Id", registry_config.client_id),
]

self.http_client = httpx.Client(
timeout=timeout,
transport=transport,
headers={"Content-Type": "application/json"},
timeout=timeout, transport=transport, headers=headers
)
self.project = project
self.apply_project(self.project)
Expand Down Expand Up @@ -145,6 +150,7 @@ def apply_entity(self, entity: Entity, project: str, commit: bool = True):
url = f"{self.base_url}/projects/{project}/entities"
data = EntityModel.from_entity(entity).json()
params = {"commit": commit}

response_data = self._send_request("PUT", url, params=params, data=data)
return EntityModel.parse_obj(response_data).to_entity()
except Exception as exception:
Expand Down
1 change: 1 addition & 0 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class RegistryConfig(FeastBaseModel):

s3_additional_kwargs: Optional[Dict[str, str]]
""" Dict[str, str]: Extra arguments to pass to boto3 when writing the registry file to S3. """
client_id: Optional[StrictStr] = "Unknown"


class RepoConfig(FeastBaseModel):
Expand Down
Loading