Skip to content

Commit cee9c22

Browse files
committed
Add Obelisk CORE URLs
1 parent 7b49cb8 commit cee9c22

File tree

4 files changed

+7
-20
lines changed

4 files changed

+7
-20
lines changed

src/obelisk/asynchronous/base.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ class BaseClient:
3232

3333
log: logging.Logger
3434

35-
_token_url = 'https://obelisk.ilabt.imec.be/api/v3/auth/token'
36-
_root_url = 'https://obelisk.ilabt.imec.be/api/v3'
37-
_metadata_url = 'https://obelisk.ilabt.imec.be/api/v3/catalog/graphql'
38-
_events_url = 'https://obelisk.ilabt.imec.be/api/v3/data/query/events'
39-
_ingest_url = 'https://obelisk.ilabt.imec.be/api/v3/data/ingest'
40-
_streams_url = 'https://obelisk.ilabt.imec.be/api/v3/data/streams'
41-
4235
def __init__(self, client: str, secret: str,
4336
retry_strategy: RetryStrategy = NoRetryStrategy(),
4437
kind: ObeliskKind = ObeliskKind.CLASSIC) -> None:
@@ -49,12 +42,6 @@ def __init__(self, client: str, secret: str,
4942

5043
self.log = logging.getLogger('obelisk')
5144

52-
self._token_url = kind.token_url
53-
self._root_url = kind.root_url
54-
self._events_url = kind.query_url
55-
self._ingest_url = kind.ingest_url
56-
self._streams_url = kind.stream_url
57-
5845
async def _get_token(self):
5946
auth_string = str(base64.b64encode(
6047
f'{self._client}:{self._secret}'.encode('utf-8')), 'utf-8')
@@ -74,7 +61,7 @@ async def _get_token(self):
7461
while not response or await retry.should_retry():
7562
try:
7663
request = await client.post(
77-
self._token_url,
64+
self.kind.token_url,
7865
json=payload if self.kind.use_json_auth else None,
7966
data=payload if not self.kind.use_json_auth else None,
8067
headers=headers)

src/obelisk/asynchronous/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def fetch_single_chunk(
9090
"limitBy": limit_by,
9191
}
9292
response = await self.http_post(
93-
self._events_url, data={k: v for k, v in payload.items() if v is not None}
93+
self.kind.query_url, data={k: v for k, v in payload.items() if v is not None}
9494
)
9595
if response.status_code != 200:
9696
self.log.warning(f"Unexpected status code: {response.status_code}")
@@ -274,7 +274,7 @@ async def send(
274274
}
275275

276276
response = await self.http_post(
277-
f"{self._ingest_url}/{dataset}", data=data, params=params
277+
f"{self.kind.ingest_url}/{dataset}", data=data, params=params
278278
)
279279
if response.status_code != 204:
280280
msg = f"An error occured during data ingest. Status {response.status_code}, message: {response.text}"

src/obelisk/asynchronous/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async def send(
193193
"""
194194

195195
response = await self.http_post(
196-
f"{self._ingest_url}/{dataset}/data/ingest", data=[x.model_dump(mode='json') for x in data]
196+
f"{self.kind.root_url}/{dataset}/data/ingest", data=[x.model_dump(mode='json') for x in data]
197197
)
198198
if response.status_code != 204:
199199
msg = f"An error occured during data ingest. Status {response.status_code}, message: {response.text}"
@@ -206,7 +206,7 @@ async def fetch_single_chunk(
206206
params: QueryParams
207207
) -> QueryResult:
208208
response = await self.http_get(
209-
f"{self._events_url}/{params.dataset}/data/query",
209+
f"{self.kind.root_url}/{params.dataset}/data/query",
210210
params=params.to_dict()
211211
)
212212

src/obelisk/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def token_url(self) -> str:
6363
case ObeliskKind.HFS:
6464
return 'https://obelisk-hfs.discover.ilabt.imec.be/auth/realms/obelisk-hfs/protocol/openid-connect/token'
6565
case ObeliskKind.CORE:
66-
raise NotImplementedError()
66+
return 'https://auth.obelisk.discover.ilabt.imec.be/realms/obelisk/protocol/openid-connect/token'
6767

6868
@property
6969
def root_url(self) -> str:
@@ -73,7 +73,7 @@ def root_url(self) -> str:
7373
case ObeliskKind.HFS:
7474
return 'https://obelisk-hfs.discover.ilabt.imec.be'
7575
case ObeliskKind.CORE:
76-
raise NotImplementedError()
76+
return 'https://obelisk.discover.ilabt.imec.be/datasets'
7777

7878
@property
7979
def query_url(self) -> str:

0 commit comments

Comments
 (0)