Skip to content

Commit 6a83f42

Browse files
authored
fix(FIR-34234): windows-compatible url parsing (#393)
1 parent 158c12f commit 6a83f42

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/firebolt/async_db/cursor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import logging
4-
import os
54
import time
65
from abc import ABCMeta, abstractmethod
76
from functools import wraps
@@ -16,6 +15,7 @@
1615
Tuple,
1716
Union,
1817
)
18+
from urllib.parse import urljoin
1919

2020
from httpx import URL, Headers, Response, codes
2121

@@ -381,7 +381,7 @@ async def _api_request(
381381
if self.parameters:
382382
parameters = {**self.parameters, **parameters}
383383
return await self._client.request(
384-
url=os.path.join(self.engine_url, path or ""),
384+
url=urljoin(self.engine_url.rstrip("/") + "/", path or ""),
385385
method="POST",
386386
params=parameters,
387387
content=query,
@@ -451,7 +451,7 @@ async def _api_request(
451451
if self.parameters:
452452
parameters = {**self.parameters, **parameters}
453453
return await self._client.request(
454-
url=os.path.join(self.engine_url, path or ""),
454+
url=urljoin(self.engine_url.rstrip("/") + "/", path or ""),
455455
method="POST",
456456
params={
457457
**(parameters or dict()),

src/firebolt/db/cursor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import logging
4-
import os
54
import time
65
from abc import ABCMeta, abstractmethod
76
from typing import (
@@ -14,6 +13,7 @@
1413
Tuple,
1514
Union,
1615
)
16+
from urllib.parse import urljoin
1717

1818
from httpx import URL, Headers, Response, codes
1919

@@ -331,7 +331,7 @@ def _api_request(
331331
if self.parameters:
332332
parameters = {**self.parameters, **parameters}
333333
return self._client.request(
334-
url=os.path.join(self.engine_url, path or ""),
334+
url=urljoin(self.engine_url.rstrip("/") + "/", path or ""),
335335
method="POST",
336336
params=parameters,
337337
content=query,
@@ -398,7 +398,7 @@ def _api_request(
398398
if self.parameters:
399399
parameters = {**self.parameters, **parameters}
400400
return self._client.request(
401-
url=os.path.join(self.engine_url, path or ""),
401+
url=urljoin(self.engine_url.rstrip("/") + "/", path or ""),
402402
method="POST",
403403
params={
404404
**(parameters or dict()),

0 commit comments

Comments
 (0)