Skip to content

Commit 9d10ee4

Browse files
Merge pull request #10 from oxylabs/feat/change-map-path
remove map/run endpoint
2 parents eb99aa7 + 2ca6913 commit 9d10ee4

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "oxylabs-ai-studio"
3-
version = "0.2.18"
3+
version = "0.2.19"
44
description = "Oxylabs studio python sdk"
55
readme = "README.md"
66
keywords = ["oxylabs", "ai", "studio"]

src/oxylabs_ai_studio/apps/ai_map.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33
from typing import Any
44

5-
import httpx
65
from pydantic import BaseModel
76

87
from oxylabs_ai_studio.client import OxyStudioAIClient
@@ -57,7 +56,7 @@ def map(
5756
try:
5857
get_response = self.call_api(
5958
client=client,
60-
url="/map/run",
59+
url="/map/run/data",
6160
method="GET",
6261
params={"run_id": run_id},
6362
)
@@ -72,7 +71,7 @@ def map(
7271
return AiMapJob(
7372
run_id=run_id,
7473
message=resp_body.get("message", None),
75-
data=self._get_data(client=client, run_id=run_id),
74+
data=resp_body.get("data", {}) or {},
7675
)
7776
if resp_body["status"] == "failed":
7877
return AiMapJob(
@@ -88,14 +87,6 @@ def map(
8887
raise e
8988
raise TimeoutError(f"Failed to map {url}: timeout.")
9089

91-
def _get_data(self, client: httpx.Client, run_id: str) -> dict[str, Any]:
92-
get_response = self.call_api(
93-
client=client, url="/map/run/data", method="GET", params={"run_id": run_id}
94-
)
95-
if get_response.status_code != 200:
96-
raise Exception(f"Failed to get data for run {run_id}: {get_response.text}")
97-
return get_response.json().get("data", {}) or {}
98-
9990
async def map_async(
10091
self,
10192
url: str,
@@ -126,7 +117,7 @@ async def map_async(
126117
try:
127118
get_response = await self.call_api_async(
128119
client=client,
129-
url="/map/run",
120+
url="/map/run/data",
130121
method="GET",
131122
params={"run_id": run_id},
132123
)
@@ -138,11 +129,10 @@ async def map_async(
138129
continue
139130
resp_body = get_response.json()
140131
if resp_body["status"] == "completed":
141-
data = await self.get_data_async(client, run_id=run_id)
142132
return AiMapJob(
143133
run_id=run_id,
144134
message=resp_body.get("message", None),
145-
data=data,
135+
data=resp_body.get("data", {}) or {},
146136
)
147137
if resp_body["status"] == "failed":
148138
return AiMapJob(
@@ -157,13 +147,3 @@ async def map_async(
157147
except Exception as e:
158148
raise e
159149
raise TimeoutError(f"Failed to map {url}: timeout.")
160-
161-
async def get_data_async(
162-
self, client: httpx.AsyncClient, run_id: str
163-
) -> dict[str, Any]:
164-
get_response = await self.call_api_async(
165-
client=client, url="/map/run/data", method="GET", params={"run_id": run_id}
166-
)
167-
if get_response.status_code != 200:
168-
raise Exception(f"Failed to get data for run {run_id}: {get_response.text}")
169-
return get_response.json().get("data", {}) or {}

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)