Z User commited on
Commit
04e663e
·
1 Parent(s): 1ec58c7

fix(apify): actor references use username~actorName, not slash

Browse files
Files changed (1) hide show
  1. app/stores/apify.py +5 -2
app/stores/apify.py CHANGED
@@ -55,7 +55,9 @@ class ApifyClient:
55
  async def run_sync(self, actor: str, run_input: dict, timeout_s: Optional[int] = None) -> List[dict]:
56
  """Run an actor and collect its default dataset items (capped wait)."""
57
  deadline = timeout_s or settings.apify_run_timeout_s
58
- url = f"/acts/{actor}/run-sync-get-dataset-items"
 
 
59
  params = {"timeout": int(deadline * 1000)}
60
  res = await self.client().post(url, params=params, json=run_input)
61
  if res.status_code in (402, 403):
@@ -69,7 +71,8 @@ class ApifyClient:
69
 
70
  async def run_async(self, actor: str, run_input: dict) -> Dict[str, str]:
71
  """Start an actor run; returns {run_id, dataset_id} for polling."""
72
- res = await self.client().post(f"/acts/{actor}/runs", json=run_input)
 
73
  res.raise_for_status()
74
  data = res.json().get("data", {})
75
  return {"run_id": data.get("id"), "dataset_id": data.get("defaultDatasetId")}
 
55
  async def run_sync(self, actor: str, run_input: dict, timeout_s: Optional[int] = None) -> List[dict]:
56
  """Run an actor and collect its default dataset items (capped wait)."""
57
  deadline = timeout_s or settings.apify_run_timeout_s
58
+ # Apify actor references use "username~actorName" (tilde), not "/".
59
+ actor_ref = actor.replace("/", "~", 1) if "~" not in actor else actor
60
+ url = f"/acts/{actor_ref}/run-sync-get-dataset-items"
61
  params = {"timeout": int(deadline * 1000)}
62
  res = await self.client().post(url, params=params, json=run_input)
63
  if res.status_code in (402, 403):
 
71
 
72
  async def run_async(self, actor: str, run_input: dict) -> Dict[str, str]:
73
  """Start an actor run; returns {run_id, dataset_id} for polling."""
74
+ actor_ref = actor.replace("/", "~", 1) if "~" not in actor else actor
75
+ res = await self.client().post(f"/acts/{actor_ref}/runs", json=run_input)
76
  res.raise_for_status()
77
  data = res.json().get("data", {})
78
  return {"run_id": data.get("id"), "dataset_id": data.get("defaultDatasetId")}