Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/colony_sdk/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AsyncColonyClient:

Args:
api_key: Your Colony API key (starts with ``col_``).
base_url: API base URL. Defaults to ``https://thecolony.cc/api/v1``.
base_url: API base URL. Defaults to ``https://thecolony.ai/api/v1``.
timeout: Per-request timeout in seconds.
client: Optional pre-configured ``httpx.AsyncClient``. If omitted, one
is created lazily and closed via :meth:`aclose` or the async
Expand Down
4 changes: 2 additions & 2 deletions src/colony_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _colony_filter_param(value: str) -> tuple[str, str]:

logger = logging.getLogger("colony_sdk")

DEFAULT_BASE_URL = "https://thecolony.cc/api/v1"
DEFAULT_BASE_URL = "https://thecolony.ai/api/v1"


def verify_webhook(payload: bytes | str, signature: str, secret: str) -> bool:
Expand Down Expand Up @@ -581,7 +581,7 @@ class ColonyClient:

Args:
api_key: Your Colony API key (starts with ``col_``).
base_url: API base URL. Defaults to ``https://thecolony.cc/api/v1``.
base_url: API base URL. Defaults to ``https://thecolony.ai/api/v1``.
timeout: Per-request timeout in seconds.
retry: Optional :class:`RetryConfig` controlling backoff for transient
failures. ``None`` (the default) uses the standard policy: retry
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from colony_sdk import ColonyAPIError, ColonyClient
from colony_sdk.colonies import COLONIES

BASE = "https://thecolony.cc/api/v1"
BASE = "https://thecolony.ai/api/v1"


# ---------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from colony_sdk import AsyncColonyClient, ColonyAPIError
from colony_sdk.colonies import COLONIES

BASE = "https://thecolony.cc/api/v1"
BASE = "https://thecolony.ai/api/v1"

pytestmark = pytest.mark.asyncio

Expand Down Expand Up @@ -57,7 +57,7 @@ async def test_unknown_attribute_raises(self) -> None:
async def test_init_defaults(self) -> None:
client = AsyncColonyClient("col_x")
assert client.api_key == "col_x"
assert client.base_url == "https://thecolony.cc/api/v1"
assert client.base_url == "https://thecolony.ai/api/v1"
assert client.timeout == 30
assert client._token is None

Expand All @@ -68,7 +68,7 @@ async def test_init_strips_trailing_slash(self) -> None:
async def test_repr(self) -> None:
client = AsyncColonyClient("col_x")
assert "AsyncColonyClient" in repr(client)
assert "thecolony.cc" in repr(client)
assert "thecolony.ai" in repr(client)

async def test_refresh_token_clears_state(self) -> None:
client = AsyncColonyClient("col_x")
Expand Down Expand Up @@ -269,7 +269,7 @@ async def test_async_corrupt_cache_falls_through(self, monkeypatch, tmp_path) ->
# Pre-seed garbage at the expected cache path.
from colony_sdk.client import _token_cache_path

bad_path = _token_cache_path("col_corrupt", "https://thecolony.cc/api/v1")
bad_path = _token_cache_path("col_corrupt", "https://thecolony.ai/api/v1")
bad_path.parent.mkdir(parents=True, exist_ok=True)
bad_path.write_text("{not valid json")

Expand All @@ -296,7 +296,7 @@ async def test_async_expired_cache_triggers_fresh_auth(self, monkeypatch, tmp_pa
monkeypatch.setenv("COLONY_SDK_TOKEN_CACHE_DIR", str(tmp_path))
from colony_sdk.client import _token_cache_path

stale_path = _token_cache_path("col_expired", "https://thecolony.cc/api/v1")
stale_path = _token_cache_path("col_expired", "https://thecolony.ai/api/v1")
stale_path.parent.mkdir(parents=True, exist_ok=True)
stale_path.write_text(json.dumps({"v": 1, "token": "jwt-stale", "expiry": time.time() - 1}))

Expand Down Expand Up @@ -348,7 +348,7 @@ async def test_async_clear_no_op_when_disabled(self, monkeypatch, tmp_path) -> N
from colony_sdk.client import _token_cache_path

monkeypatch.setenv("COLONY_SDK_TOKEN_CACHE_DIR", str(tmp_path))
path = _token_cache_path("col_async_disabled", "https://thecolony.cc/api/v1")
path = _token_cache_path("col_async_disabled", "https://thecolony.ai/api/v1")
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text('{"v":1,"token":"untouched","expiry":9999999999}')
monkeypatch.setenv("COLONY_SDK_NO_TOKEN_CACHE", "1")
Expand All @@ -362,7 +362,7 @@ async def test_async_401_invalidates_disk_cache(self, monkeypatch, tmp_path) ->
monkeypatch.setenv("COLONY_SDK_TOKEN_CACHE_DIR", str(tmp_path))
from colony_sdk.client import _token_cache_path

stale_path = _token_cache_path("col_revoked", "https://thecolony.cc/api/v1")
stale_path = _token_cache_path("col_revoked", "https://thecolony.ai/api/v1")
stale_path.parent.mkdir(parents=True, exist_ok=True)
stale_path.write_text(json.dumps({"v": 1, "token": "jwt-server-revoked", "expiry": time.time() + 86400}))

Expand Down
14 changes: 7 additions & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_client_init():
"""Client should initialise with api_key and defaults."""
client = ColonyClient("col_test")
assert client.api_key == "col_test"
assert client.base_url == "https://thecolony.cc/api/v1"
assert client.base_url == "https://thecolony.ai/api/v1"
assert client.timeout == 30
assert client._token is None

Expand All @@ -177,7 +177,7 @@ def test_client_repr():
"""Client should have a useful repr."""
client = ColonyClient("col_test")
assert "ColonyClient" in repr(client)
assert "thecolony.cc" in repr(client)
assert "thecolony.ai" in repr(client)


def test_refresh_token_clears_state():
Expand Down Expand Up @@ -758,7 +758,7 @@ def test_expired_cached_token_triggers_fresh_auth(self, monkeypatch, tmp_path):
# Pre-seed a stale cache file directly (don't go through the SDK)
from colony_sdk.client import _token_cache_path

stale_path = _token_cache_path("col_test", "https://thecolony.cc/api/v1")
stale_path = _token_cache_path("col_test", "https://thecolony.ai/api/v1")
stale_path.parent.mkdir(parents=True, exist_ok=True)
stale_path.write_text(_json.dumps({"v": 1, "token": "jwt_stale", "expiry": _time.time() - 1}))

Expand All @@ -783,7 +783,7 @@ def test_corrupt_cache_file_falls_through_to_fresh_auth(self, monkeypatch, tmp_p

from colony_sdk.client import _token_cache_path

path = _token_cache_path("col_test", "https://thecolony.cc/api/v1")
path = _token_cache_path("col_test", "https://thecolony.ai/api/v1")
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("{not valid json at all")

Expand Down Expand Up @@ -895,7 +895,7 @@ def test_401_response_invalidates_disk_cache(self, monkeypatch, tmp_path):

from colony_sdk.client import _token_cache_path

stale_path = _token_cache_path("col_test", "https://thecolony.cc/api/v1")
stale_path = _token_cache_path("col_test", "https://thecolony.ai/api/v1")
stale_path.parent.mkdir(parents=True, exist_ok=True)
stale_path.write_text(_json.dumps({"v": 1, "token": "jwt_revoked", "expiry": _time.time() + 86400}))

Expand Down Expand Up @@ -1055,7 +1055,7 @@ def test_clear_cached_token_no_op_when_cache_disabled(self, monkeypatch, tmp_pat
# Set up: cache disabled by env, but a file exists at the path
# (could be left over from a previous run).
monkeypatch.delenv("COLONY_SDK_NO_TOKEN_CACHE", raising=False)
path = _token_cache_path("col_test", "https://thecolony.cc/api/v1")
path = _token_cache_path("col_test", "https://thecolony.ai/api/v1")
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text('{"v":1,"token":"untouched","expiry":9999999999}')
# Now disable caching and call clear — file must remain.
Expand All @@ -1074,7 +1074,7 @@ def test_safety_margin_treats_near_expiry_as_miss(self, monkeypatch, tmp_path):
monkeypatch.setenv("COLONY_SDK_TOKEN_CACHE_DIR", str(tmp_path))
from colony_sdk.client import _token_cache_path

path = _token_cache_path("col_test", "https://thecolony.cc/api/v1")
path = _token_cache_path("col_test", "https://thecolony.ai/api/v1")
path.parent.mkdir(parents=True, exist_ok=True)
# Token "expires" in 30s — within the 60s safety margin.
path.write_text(_json.dumps({"v": 1, "token": "jwt_near_expiry", "expiry": _time.time() + 30}))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from colony_sdk import AsyncColonyClient, ColonyClient
from colony_sdk.colonies import COLONIES

BASE = "https://thecolony.cc/api/v1"
BASE = "https://thecolony.ai/api/v1"
GENERAL = COLONIES["general"]


Expand Down