Skip to content

Commit 522d9b1

Browse files
Den 426 Increase reliability-of-dev-config(#75)
1 parent 55de690 commit 522d9b1

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

dendrite/async_api/_api/_http_client.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import os
12
from typing import Optional
23
import httpx
34
from loguru import logger
45

56

67
from dendrite.async_api._core.models.api_config import APIConfig
7-
from dendrite.async_api._common.constants import DENDRITE_API_BASE_URL
88

99

1010
class HTTPClient:
@@ -14,7 +14,12 @@ def __init__(self, api_config: APIConfig, session_id: Optional[str] = None):
1414
self.base_url = self.resolve_base_url()
1515

1616
def resolve_base_url(self):
17-
return DENDRITE_API_BASE_URL
17+
base_url = (
18+
"http://localhost:8000/api/v1"
19+
if os.environ.get("DENDRITE_DEV")
20+
else "https://dendrite-server.azurewebsites.net/api/v1"
21+
)
22+
return base_url
1823

1924
async def send_request(
2025
self,

dendrite/async_api/_common/constants.py

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
import os
2-
3-
DENDRITE_API_BASE_URL = (
4-
"http://localhost:8000/api/v1"
5-
if os.environ.get("DENDRITE_DEV")
6-
else "https://dendrite-server.azurewebsites.net/api/v1"
7-
)
8-
9-
101
STEALTH_ARGS = [
112
"--no-pings",
123
"--mute-audio",

dendrite/sync_api/_api/_http_client.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import os
12
from typing import Optional
23
import httpx
34
from loguru import logger
45
from dendrite.sync_api._core.models.api_config import APIConfig
5-
from dendrite.sync_api._common.constants import DENDRITE_API_BASE_URL
66

77

88
class HTTPClient:
@@ -13,7 +13,12 @@ def __init__(self, api_config: APIConfig, session_id: Optional[str] = None):
1313
self.base_url = self.resolve_base_url()
1414

1515
def resolve_base_url(self):
16-
return DENDRITE_API_BASE_URL
16+
base_url = (
17+
"http://localhost:8000/api/v1"
18+
if os.environ.get("DENDRITE_DEV")
19+
else "https://dendrite-server.azurewebsites.net/api/v1"
20+
)
21+
return base_url
1722

1823
def send_request(
1924
self,

dendrite/sync_api/_common/constants.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import os
2-
3-
DENDRITE_API_BASE_URL = (
4-
"http://localhost:8000/api/v1"
5-
if os.environ.get("DENDRITE_DEV")
6-
else "https://dendrite-server.azurewebsites.net/api/v1"
7-
)
81
STEALTH_ARGS = [
92
"--no-pings",
103
"--mute-audio",

0 commit comments

Comments
 (0)