Migrate CLI and Python packages to centralized aitbc package utilities

CLI migration:
- Migrate 11 CLI files from old import pattern to centralized aitbc imports
- wallet.py, exchange.py, gpu_marketplace.py, exchange_island.py, monitor.py, cross_chain.py
- aitbc_cli.py, handlers (account.py, bridge.py, pool_hub.py), utils (wallet_daemon_client.py)
- Replace 'from aitbc.aitbc_logging import' with 'from aitbc import get_logger'
- Replace 'from aitbc.http_client import' with 'from aitbc import AITBCHTTPClient'
- Replace 'from aitbc.exceptions import' with 'from aitbc import NetworkError'

Packages migration:
- aitbc-sdk: receipts.py - migrate from httpx to AITBCHTTPClient
- aitbc-agent-sdk: 5 files - migrate logging to get_logger
  - agent.py, compute_provider.py, compute_consumer.py, swarm_coordinator.py, platform_builder.py
This commit is contained in:
aitbc
2026-04-25 07:04:57 +02:00
parent 55060730b2
commit 119d0f42c0
17 changed files with 282 additions and 459 deletions

View File

@@ -4,9 +4,9 @@ import time
from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, Iterator, List, Optional, cast
import httpx
import base64
from aitbc import AITBCHTTPClient, NetworkError
from aitbc_crypto.signing import ReceiptVerifier
@@ -83,8 +83,8 @@ class CoordinatorReceiptClient:
self.max_retries = max_retries
self.backoff_seconds = backoff_seconds
def _client(self) -> httpx.Client:
return httpx.Client(
def _client(self) -> AITBCHTTPClient:
return AITBCHTTPClient(
base_url=self.base_url,
timeout=self.timeout,
headers={"X-Api-Key": self.api_key},
@@ -187,9 +187,9 @@ class CoordinatorReceiptClient:
attempt = 0
while True:
try:
with self._client() as client:
response = client.request(method=method, url=url, params=params)
except httpx.HTTPError:
client = self._client()
response = client.request(method=method, url=url, params=params)
except NetworkError:
if attempt >= self.max_retries:
raise
attempt += 1