From 16ab57218d55eddcd80371e23e7925cd00bd899c Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Fri, 11 Jul 2025 16:27:55 -0400 Subject: [PATCH 1/2] chore: fold dx into dxui (#43) https://coveord.atlassian.net/browse/KIT-4542 --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index dca7cac..5938940 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @coveo/dx +* @coveo/dxui From fc8a99a53c6f3b4882fbbc8a79e1b383a3ef0214 Mon Sep 17 00:00:00 2001 From: Nicolas Bernier Date: Thu, 27 Nov 2025 16:16:12 +0000 Subject: [PATCH 2/2] Suggesting a fix to the platformclient so a region can be specified --- .devcontainer/devcontainer.json | 9 +++++++++ .devcontainer/post-create.sh | 4 ++++ src/push_api_clientpy/platformclient.py | 14 +++++++++++--- src/push_api_clientpy/source.py | 4 ++-- 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/post-create.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3d2a8ad --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,9 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + "image": "mcr.microsoft.com/devcontainers/python:2-3.9-trixie", + + "postCreateCommand": ["bash",".devcontainer/post-create.sh"] + +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..5e4606a --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +pip install pipenv +pipenv install --dev \ No newline at end of file diff --git a/src/push_api_clientpy/platformclient.py b/src/push_api_clientpy/platformclient.py index eea8d02..a09c4ba 100644 --- a/src/push_api_clientpy/platformclient.py +++ b/src/push_api_clientpy/platformclient.py @@ -114,10 +114,11 @@ class BackoffOptions: class PlatformClient: - def __init__(self, apikey: str, organizationid: str, backoff_options: BackoffOptions = BackoffOptions(), session = requests.Session()): + def __init__(self, apikey: str, organizationid: str, backoff_options: BackoffOptions = BackoffOptions(), region = 'us', session = requests.Session()): self.apikey = apikey self.organizationid = organizationid self.backoff_options = backoff_options + self.region = region self.retries = Retry(total=self.backoff_options.max_retries, backoff_factor=self.backoff_options.retry_after, @@ -187,10 +188,17 @@ def pushFileContainerContent(self, sourceId: str, fileContainer: FileContainer): return self.session.put(url=url, params=queryParams, headers=self.__headers()) def __basePushURL(self): - return f'https://api.cloud.coveo.com/push/v1/organizations/{self.organizationid}' + if self.region == "us": + return f'https://api.cloud.coveo.com/push/v1/organizations/{self.organizationid}' + else: + return f'https://api-{self.region}.cloud.coveo.com/push/v1/organizations/{self.organizationid}' + def __basePlatformURL(self): - return f'https://platform.cloud.coveo.com/rest/organizations/{self.organizationid}' + if self.region == "us": + return f'https://platform.cloud.coveo.com/rest/organizations/{self.organizationid}' + else: + return f'https://platform-{self.region}.cloud.coveo.com/rest/organizations/{self.organizationid}' def __baseSourceURL(self): return f'{self.__basePlatformURL()}/sources' diff --git a/src/push_api_clientpy/source.py b/src/push_api_clientpy/source.py index 15bd310..0f64404 100644 --- a/src/push_api_clientpy/source.py +++ b/src/push_api_clientpy/source.py @@ -11,8 +11,8 @@ class BatchUpdate(BatchUpdateDocuments): class Source: - def __init__(self, apikey: str, organizationid: str, backoff_options: BackoffOptions = BackoffOptions()): - self.client = PlatformClient(apikey, organizationid, backoff_options) + def __init__(self, apikey: str, organizationid: str, backoff_options: BackoffOptions = BackoffOptions(), region = 'us'): + self.client = PlatformClient(apikey, organizationid, backoff_options, region) def create(self, name: str, visibility: SourceVisibility): return self.client.createSource(name, visibility)