refactor(cli): update API endpoints to v1 versioning and add dynamic port configuration to mock server

- Update mock-cli-server.py to use dynamic port allocation (8020-8050 range)
  - Add socket-based port availability checking
  - Generate dynamic config file at cli-dev/cli-staging-config-dynamic.yaml
  - Remove docstring header and shebang
  - Update endpoint paths: /v1/marketplace/gpus → /v1/marketplace/gpu/list, /v1/agent/workflows → /v1/agents/workflows

- Standardize all CLI command API
This commit is contained in:
oib
2026-03-04 23:24:10 +01:00
parent a200a50085
commit 210a77d860
13 changed files with 249 additions and 81 deletions

0
cli/README.md Normal file
View File

View File

@@ -50,7 +50,7 @@ def create(ctx, name: str, description: str, workflow_file, verification: str,
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/workflows",
f"{config.coordinator_url}/v1/agents/workflows",
headers={"X-Api-Key": config.api_key or ""},
json=workflow_data
)
@@ -94,7 +94,7 @@ def list(ctx, agent_type: Optional[str], status: Optional[str],
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/workflows",
f"{config.coordinator_url}/v1/agents/workflows",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -141,7 +141,7 @@ def execute(ctx, agent_id: str, inputs, verification: str, priority: str, timeou
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/{agent_id}/execute",
f"{config.coordinator_url}/v1/agents/{agent_id}/execute",
headers={"X-Api-Key": config.api_key or ""},
json=execution_data
)
@@ -173,7 +173,7 @@ def status(ctx, execution_id: str, watch: bool, interval: int):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/executions/{execution_id}",
f"{config.coordinator_url}/v1/agents/executions/{execution_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -219,7 +219,7 @@ def receipt(ctx, execution_id: str, verify: bool, download: Optional[str]):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/executions/{execution_id}/receipt",
f"{config.coordinator_url}/v1/agents/executions/{execution_id}/receipt",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -229,7 +229,7 @@ def receipt(ctx, execution_id: str, verify: bool, download: Optional[str]):
if verify:
# Verify receipt
verify_response = client.post(
f"{config.coordinator_url}/agents/receipts/verify",
f"{config.coordinator_url}/v1/agents/receipts/verify",
headers={"X-Api-Key": config.api_key or ""},
json={"receipt": receipt_data}
)
@@ -292,7 +292,7 @@ def create(ctx, name: str, agents: str, description: str, coordination: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/networks",
f"{config.coordinator_url}/v1/agents/networks",
headers={"X-Api-Key": config.api_key or ""},
json=network_data
)
@@ -335,7 +335,7 @@ def execute(ctx, network_id: str, task, priority: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/networks/{network_id}/execute",
f"{config.coordinator_url}/v1/agents/networks/{network_id}/execute",
headers={"X-Api-Key": config.api_key or ""},
json=execution_data
)
@@ -370,7 +370,7 @@ def status(ctx, network_id: str, metrics: str, real_time: bool):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/networks/{network_id}/status",
f"{config.coordinator_url}/v1/agents/networks/{network_id}/status",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -401,7 +401,7 @@ def optimize(ctx, network_id: str, objective: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/networks/{network_id}/optimize",
f"{config.coordinator_url}/v1/agents/networks/{network_id}/optimize",
headers={"X-Api-Key": config.api_key or ""},
json=optimization_data
)
@@ -452,7 +452,7 @@ def enable(ctx, agent_id: str, mode: str, feedback_source: Optional[str], learni
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/{agent_id}/learning/enable",
f"{config.coordinator_url}/v1/agents/{agent_id}/learning/enable",
headers={"X-Api-Key": config.api_key or ""},
json=learning_config
)
@@ -494,7 +494,7 @@ def train(ctx, agent_id: str, feedback, epochs: int):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/{agent_id}/learning/train",
f"{config.coordinator_url}/v1/agents/{agent_id}/learning/train",
headers={"X-Api-Key": config.api_key or ""},
json=training_data
)
@@ -526,7 +526,7 @@ def progress(ctx, agent_id: str, metrics: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/{agent_id}/learning/progress",
f"{config.coordinator_url}/v1/agents/{agent_id}/learning/progress",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -557,7 +557,7 @@ def export(ctx, agent_id: str, format: str, output_path: Optional[str]):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/agents/{agent_id}/learning/export",
f"{config.coordinator_url}/v1/agents/{agent_id}/learning/export",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -605,7 +605,7 @@ def submit_contribution(ctx, type: str, description: str, github_repo: str, bran
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/agents/contributions",
f"{config.coordinator_url}/v1/agents/contributions",
headers={"X-Api-Key": config.api_key or ""},
json=contribution_data
)

View File

@@ -48,7 +48,7 @@ def submit(ctx, job_type: str, prompt: Optional[str], model: Optional[str],
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/jobs",
f"{config.coordinator_url}/v1/jobs",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -98,7 +98,7 @@ def status(ctx, job_id: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/jobs/{job_id}",
f"{config.coordinator_url}/v1/jobs/{job_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -123,7 +123,7 @@ def blocks(ctx, limit: int):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/explorer/blocks",
f"{config.coordinator_url}/v1/explorer/blocks",
params={"limit": limit},
headers={"X-Api-Key": config.api_key or ""}
)
@@ -149,7 +149,7 @@ def cancel(ctx, job_id: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/jobs/{job_id}/cancel",
f"{config.coordinator_url}/v1/jobs/{job_id}/cancel",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -181,7 +181,7 @@ def receipts(ctx, limit: int, job_id: Optional[str], status: Optional[str]):
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/explorer/receipts",
f"{config.coordinator_url}/v1/explorer/receipts",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -222,7 +222,7 @@ def history(ctx, limit: int, status: Optional[str], type: Optional[str],
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/jobs",
f"{config.coordinator_url}/v1/jobs",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -283,7 +283,7 @@ def batch_submit(ctx, file_path: str, file_format: Optional[str], retries: int,
with httpx.Client() as http_client:
response = http_client.post(
f"{config.coordinator_url}/jobs",
f"{config.coordinator_url}/v1/jobs",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -387,7 +387,7 @@ def pay(ctx, job_id: str, amount: float, currency: str, payment_method: str, esc
try:
with httpx.Client() as http_client:
response = http_client.post(
f"{config.coordinator_url}/payments",
f"{config.coordinator_url}/v1/payments",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -422,7 +422,7 @@ def payment_status(ctx, job_id: str):
try:
with httpx.Client() as http_client:
response = http_client.get(
f"{config.coordinator_url}/jobs/{job_id}/payment",
f"{config.coordinator_url}/v1/jobs/{job_id}/payment",
headers={"X-Api-Key": config.api_key or ""}
)
if response.status_code == 200:
@@ -448,7 +448,7 @@ def payment_receipt(ctx, payment_id: str):
try:
with httpx.Client() as http_client:
response = http_client.get(
f"{config.coordinator_url}/payments/{payment_id}/receipt",
f"{config.coordinator_url}/v1/payments/{payment_id}/receipt",
headers={"X-Api-Key": config.api_key or ""}
)
if response.status_code == 200:
@@ -476,7 +476,7 @@ def refund(ctx, job_id: str, payment_id: str, reason: str):
try:
with httpx.Client() as http_client:
response = http_client.post(
f"{config.coordinator_url}/payments/{payment_id}/refund",
f"{config.coordinator_url}/v1/payments/{payment_id}/refund",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""

View File

@@ -51,7 +51,7 @@ def register(ctx, name: str, memory: Optional[int], cuda_cores: Optional[int],
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/gpu/register",
f"{config.coordinator_url}/v1/marketplace/gpu/register",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or "",
@@ -96,7 +96,7 @@ def list(ctx, available: bool, model: Optional[str], memory_min: Optional[int],
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/gpu/list",
f"{config.coordinator_url}/v1/marketplace/gpu/list",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -120,7 +120,7 @@ def details(ctx, gpu_id: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/gpu/{gpu_id}",
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -152,7 +152,7 @@ def book(ctx, gpu_id: str, hours: float, job_id: Optional[str]):
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/gpu/{gpu_id}/book",
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/book",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -180,7 +180,7 @@ def release(ctx, gpu_id: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/gpu/{gpu_id}/release",
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/release",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -208,7 +208,7 @@ def orders(ctx, status: Optional[str], limit: int):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/orders",
f"{config.coordinator_url}/v1/marketplace/orders",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -232,7 +232,7 @@ def pricing(ctx, model: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/pricing/{model}",
f"{config.coordinator_url}/v1/marketplace/pricing/{model}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -256,7 +256,7 @@ def reviews(ctx, gpu_id: str, limit: int):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/gpu/{gpu_id}/reviews",
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/reviews",
params={"limit": limit},
headers={"X-Api-Key": config.api_key or ""}
)
@@ -291,7 +291,7 @@ def review(ctx, gpu_id: str, rating: int, comment: Optional[str]):
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/gpu/{gpu_id}/reviews",
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/reviews",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -344,7 +344,7 @@ def submit(ctx, provider: str, capacity: int, price: float, notes: Optional[str]
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/bids",
f"{config.coordinator_url}/v1/marketplace/bids",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -383,7 +383,7 @@ def list(ctx, status: Optional[str], provider: Optional[str], limit: int):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/bids",
f"{config.coordinator_url}/v1/marketplace/bids",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -407,7 +407,7 @@ def details(ctx, bid_id: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/bids/{bid_id}",
f"{config.coordinator_url}/v1/marketplace/bids/{bid_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -455,7 +455,7 @@ def list(ctx, status: Optional[str], gpu_model: Optional[str], price_max: Option
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/offers",
f"{config.coordinator_url}/v1/marketplace/offers",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -578,7 +578,7 @@ def list_resource(ctx, resource_id: str, resource_type: str, compute_power: floa
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/list",
f"{config.coordinator_url}/v1/marketplace/list",
json=resource_data,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -617,7 +617,7 @@ def rent(ctx, resource_id: str, consumer_id: str, duration: int, max_price: Opti
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/rent",
f"{config.coordinator_url}/v1/marketplace/rent",
json=rental_data,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -930,7 +930,7 @@ def health(ctx):
endpoints = [
"/health",
"/v1/marketplace/status",
"/v1/v1/marketplace/status",
"/v1/agents/health",
"/v1/blockchain/health"
]

View File

@@ -47,7 +47,7 @@ def list(ctx, nft_version: str, category: Optional[str], tags: Optional[str],
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/advanced/models",
f"{config.coordinator_url}/v1/marketplace/advanced/models",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -105,7 +105,7 @@ def mint(ctx, model_file: str, metadata, price: Optional[float], royalty: float,
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/models/mint",
f"{config.coordinator_url}/v1/marketplace/advanced/models/mint",
headers={"X-Api-Key": config.api_key or ""},
data=nft_data,
files=files
@@ -157,7 +157,7 @@ def update(ctx, nft_id: str, new_version: str, version_notes: str, compatibility
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/models/{nft_id}/update",
f"{config.coordinator_url}/v1/marketplace/advanced/models/{nft_id}/update",
headers={"X-Api-Key": config.api_key or ""},
data=update_data,
files=files
@@ -196,7 +196,7 @@ def verify(ctx, nft_id: str, deep_scan: bool, check_integrity: bool, verify_perf
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/models/{nft_id}/verify",
f"{config.coordinator_url}/v1/marketplace/advanced/models/{nft_id}/verify",
headers={"X-Api-Key": config.api_key or ""},
json=verify_data
)
@@ -253,7 +253,7 @@ def analytics(ctx, period: str, metrics: str, category: Optional[str], output_fo
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/advanced/analytics",
f"{config.coordinator_url}/v1/marketplace/advanced/analytics",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -295,7 +295,7 @@ def benchmark(ctx, model_id: str, competitors: bool, datasets: str, iterations:
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/models/{model_id}/benchmark",
f"{config.coordinator_url}/v1/marketplace/advanced/models/{model_id}/benchmark",
headers={"X-Api-Key": config.api_key or ""},
json=benchmark_data
)
@@ -334,7 +334,7 @@ def trends(ctx, category: Optional[str], forecast: str, confidence: float):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/advanced/trends",
f"{config.coordinator_url}/v1/marketplace/advanced/trends",
headers={"X-Api-Key": config.api_key or ""},
params=params
)
@@ -371,7 +371,7 @@ def report(ctx, format: str, email: Optional[str], sections: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/reports/generate",
f"{config.coordinator_url}/v1/marketplace/advanced/reports/generate",
headers={"X-Api-Key": config.api_key or ""},
json=report_data
)
@@ -420,7 +420,7 @@ def bid(ctx, auction_id: str, amount: float, max_auto_bid: Optional[float], prox
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/auctions/{auction_id}/bid",
f"{config.coordinator_url}/v1/marketplace/advanced/auctions/{auction_id}/bid",
headers={"X-Api-Key": config.api_key or ""},
json=bid_data
)
@@ -466,7 +466,7 @@ def royalties(ctx, model_id: str, recipients: str, smart_contract: bool):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/models/{model_id}/royalties",
f"{config.coordinator_url}/v1/marketplace/advanced/models/{model_id}/royalties",
headers={"X-Api-Key": config.api_key or ""},
json=royalty_data
)
@@ -569,7 +569,7 @@ def file(ctx, transaction_id: str, reason: str, evidence, category: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/disputes",
f"{config.coordinator_url}/v1/marketplace/advanced/disputes",
headers={"X-Api-Key": config.api_key or ""},
data=dispute_data,
files=files
@@ -599,7 +599,7 @@ def status(ctx, dispute_id: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/marketplace/advanced/disputes/{dispute_id}",
f"{config.coordinator_url}/v1/marketplace/advanced/disputes/{dispute_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -634,7 +634,7 @@ def resolve(ctx, dispute_id: str, resolution: str, evidence):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/marketplace/advanced/disputes/{dispute_id}/resolve",
f"{config.coordinator_url}/v1/marketplace/advanced/disputes/{dispute_id}/resolve",
headers={"X-Api-Key": config.api_key or ""},
data=resolution_data,
files=files

View File

@@ -49,7 +49,7 @@ def register(ctx, gpu: Optional[str], memory: Optional[int],
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/miners/register?miner_id={miner_id}",
f"{config.coordinator_url}/v1/miners/register?miner_id={miner_id}",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -80,7 +80,7 @@ def poll(ctx, wait: int, miner_id: str):
try:
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/miners/poll",
f"{config.coordinator_url}/v1/miners/poll",
headers={
"X-Api-Key": config.api_key or "",
"X-Miner-ID": miner_id
@@ -116,7 +116,7 @@ def mine(ctx, jobs: int, miner_id: str):
with httpx.Client() as client:
# Poll for job
response = client.get(
f"{config.coordinator_url}/miners/poll",
f"{config.coordinator_url}/v1/miners/poll",
headers={
"X-Api-Key": config.api_key or "",
"X-Miner-ID": miner_id
@@ -139,7 +139,7 @@ def mine(ctx, jobs: int, miner_id: str):
# Submit result
result_response = client.post(
f"{config.coordinator_url}/miners/{job_id}/result",
f"{config.coordinator_url}/v1/miners/{job_id}/result",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or "",
@@ -183,7 +183,7 @@ def heartbeat(ctx, miner_id: str):
try:
with httpx.Client() as client:
response = client.post(
f"{config.coordinator_url}/miners/heartbeat?miner_id={miner_id}",
f"{config.coordinator_url}/v1/miners/heartbeat?miner_id={miner_id}",
headers={
"X-Api-Key": config.api_key or ""
}
@@ -235,7 +235,7 @@ def earnings(ctx, miner_id: str, from_time: Optional[str], to_time: Optional[str
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/miners/{miner_id}/earnings",
f"{config.coordinator_url}/v1/miners/{miner_id}/earnings",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -281,7 +281,7 @@ def update_capabilities(ctx, gpu: Optional[str], memory: Optional[int],
try:
with httpx.Client() as client:
response = client.put(
f"{config.coordinator_url}/miners/{miner_id}/capabilities",
f"{config.coordinator_url}/v1/miners/{miner_id}/capabilities",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or ""
@@ -319,7 +319,7 @@ def deregister(ctx, miner_id: str, force: bool):
try:
with httpx.Client() as client:
response = client.delete(
f"{config.coordinator_url}/miners/{miner_id}",
f"{config.coordinator_url}/v1/miners/{miner_id}",
headers={"X-Api-Key": config.api_key or ""}
)
@@ -359,7 +359,7 @@ def jobs(ctx, limit: int, job_type: Optional[str], min_reward: Optional[float],
with httpx.Client() as client:
response = client.get(
f"{config.coordinator_url}/miners/{miner_id}/jobs",
f"{config.coordinator_url}/v1/miners/{miner_id}/jobs",
params=params,
headers={"X-Api-Key": config.api_key or ""}
)
@@ -380,7 +380,7 @@ def _process_single_job(config, miner_id: str, worker_id: int) -> Dict[str, Any]
try:
with httpx.Client() as http_client:
response = http_client.get(
f"{config.coordinator_url}/miners/poll",
f"{config.coordinator_url}/v1/miners/poll",
headers={
"X-Api-Key": config.api_key or "",
"X-Miner-ID": miner_id
@@ -395,7 +395,7 @@ def _process_single_job(config, miner_id: str, worker_id: int) -> Dict[str, Any]
time.sleep(2) # Simulate processing
result_response = http_client.post(
f"{config.coordinator_url}/miners/{job_id}/result",
f"{config.coordinator_url}/v1/miners/{job_id}/result",
headers={
"Content-Type": "application/json",
"X-Api-Key": config.api_key or "",

View File

@@ -66,7 +66,7 @@ def api(ctx, endpoint, method, data):
import httpx
# Prepare request
url = f"{config.coordinator_url.rstrip('/')}/api/v1/{endpoint.lstrip('/')}"
url = f"{config.coordinator_url.rstrip('/')}/{endpoint.lstrip('/')}"
headers = {}
if config.api_key:
headers['Authorization'] = f"Bearer {config.api_key}"