i think were going in circles
This commit is contained in:
1 parent
8c11958d95
commit
6d376c3653
1 file changed
+9
-5
+9
-5
@@ -64,8 +64,9 @@ async def get_item_by_id(item_id: str) -> dict:
|
||||
Exception: If item not found or API error
|
||||
"""
|
||||
try:
|
||||
result = await client.catalog.batch_retrieve_catalog_objects(
|
||||
body={"object_ids": [item_id], "include_related_objects": True}
|
||||
result = await client.catalog.search(
|
||||
object_types=["ITEM"],
|
||||
query={"exact_query": {"attribute_name": "id", "attribute_value": item_id}},
|
||||
)
|
||||
result_json = json.loads(result.model_dump_json())
|
||||
|
||||
@@ -107,9 +108,12 @@ async def get_item_by_variation_id(variation_id: str) -> dict:
|
||||
Exception: If variation/item not found or API error
|
||||
"""
|
||||
try:
|
||||
# Get variation object using batch_retrieve
|
||||
result = await client.catalog.batch_retrieve_catalog_objects(
|
||||
body={"object_ids": [variation_id], "include_related_objects": True}
|
||||
# Get variation object using search
|
||||
result = await client.catalog.search(
|
||||
object_types=["ITEM_VARIATION"],
|
||||
query={
|
||||
"exact_query": {"attribute_name": "id", "attribute_value": variation_id}
|
||||
},
|
||||
)
|
||||
result_json = json.loads(result.model_dump_json())
|
||||
|
||||
|
||||
Reference in new issue
Block a user