alita-sdk 0.3.160__py3-none-any.whl → 0.3.161__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alita_sdk/tools/postman/api_wrapper.py +49 -45
- {alita_sdk-0.3.160.dist-info → alita_sdk-0.3.161.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.160.dist-info → alita_sdk-0.3.161.dist-info}/RECORD +6 -6
- {alita_sdk-0.3.160.dist-info → alita_sdk-0.3.161.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.160.dist-info → alita_sdk-0.3.161.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.160.dist-info → alita_sdk-0.3.161.dist-info}/top_level.txt +0 -0
@@ -1370,33 +1370,30 @@ class PostmanApiWrapper(BaseToolApiWrapper):
|
|
1370
1370
|
def update_request_tests(self, request_path: str, tests: str, **kwargs) -> str:
|
1371
1371
|
"""Update request test scripts."""
|
1372
1372
|
try:
|
1373
|
-
# Get
|
1374
|
-
|
1375
|
-
|
1376
|
-
# Get current request to preserve existing data
|
1377
|
-
current_request = self._make_request('GET', f'/collections/{self.collection_id}/requests/{request_id}')
|
1378
|
-
request_data = current_request.get("data", {})
|
1373
|
+
# Get request item and ID
|
1374
|
+
request_item, request_id, _ = self._get_request_item_and_id(request_path)
|
1379
1375
|
|
1380
|
-
#
|
1381
|
-
|
1376
|
+
# Get existing events and preserve non-test events
|
1377
|
+
existing_events = request_item.get("event", [])
|
1378
|
+
events = [event for event in existing_events if event.get("listen") != "test"]
|
1382
1379
|
|
1383
|
-
# Add the new test script
|
1380
|
+
# Add the new test script using the official API format
|
1384
1381
|
events.append({
|
1385
1382
|
"listen": "test",
|
1386
1383
|
"script": {
|
1387
|
-
"
|
1388
|
-
"
|
1384
|
+
"exec": tests.strip().split('\n'),
|
1385
|
+
"type": "text/javascript"
|
1389
1386
|
}
|
1390
1387
|
})
|
1391
1388
|
|
1392
|
-
#
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1389
|
+
# Create update payload using the events array format from official spec
|
1390
|
+
request_update = {
|
1391
|
+
"events": events
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
# Update using the individual request endpoint with proper events format
|
1396
1395
|
response = self._make_request('PUT', f'/collections/{self.collection_id}/requests/{request_id}',
|
1397
|
-
|
1398
|
-
|
1399
|
-
logger.info(f"Test script updated successfully for request '{request_path}'")
|
1396
|
+
json=request_update)
|
1400
1397
|
return json.dumps({"success": True, "message": f"Request '{request_path}' tests updated successfully"}, indent=2)
|
1401
1398
|
except Exception as e:
|
1402
1399
|
stacktrace = format_exc()
|
@@ -1407,33 +1404,30 @@ class PostmanApiWrapper(BaseToolApiWrapper):
|
|
1407
1404
|
def update_request_pre_script(self, request_path: str, pre_request_script: str, **kwargs) -> str:
|
1408
1405
|
"""Update request pre-request scripts."""
|
1409
1406
|
try:
|
1410
|
-
# Get
|
1411
|
-
|
1412
|
-
|
1413
|
-
# Get current request to preserve existing data
|
1414
|
-
current_request = self._make_request('GET', f'/collections/{self.collection_id}/requests/{request_id}')
|
1415
|
-
request_data = current_request.get("data", {})
|
1407
|
+
# Get request item and ID
|
1408
|
+
request_item, request_id, _ = self._get_request_item_and_id(request_path)
|
1416
1409
|
|
1417
|
-
#
|
1418
|
-
|
1410
|
+
# Get existing events and preserve non-prerequest events
|
1411
|
+
existing_events = request_item.get("event", [])
|
1412
|
+
events = [event for event in existing_events if event.get("listen") != "prerequest"]
|
1419
1413
|
|
1420
|
-
# Add the new prerequest script
|
1414
|
+
# Add the new prerequest script using the official API format
|
1421
1415
|
events.append({
|
1422
1416
|
"listen": "prerequest",
|
1423
1417
|
"script": {
|
1424
|
-
"
|
1425
|
-
"
|
1418
|
+
"exec": pre_request_script.strip().split('\n'),
|
1419
|
+
"type": "text/javascript"
|
1426
1420
|
}
|
1427
1421
|
})
|
1428
1422
|
|
1429
|
-
#
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1423
|
+
# Create update payload using the events array format from official spec
|
1424
|
+
request_update = {
|
1425
|
+
"events": events
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
# Update using the individual request endpoint with proper events format
|
1433
1429
|
response = self._make_request('PUT', f'/collections/{self.collection_id}/requests/{request_id}',
|
1434
|
-
|
1435
|
-
|
1436
|
-
logger.info(f"Pre-request script updated successfully for request '{request_path}'")
|
1430
|
+
json=request_update)
|
1437
1431
|
return json.dumps({"success": True, "message": f"Request '{request_path}' pre-script updated successfully"}, indent=2)
|
1438
1432
|
except Exception as e:
|
1439
1433
|
stacktrace = format_exc()
|
@@ -1612,16 +1606,14 @@ class PostmanApiWrapper(BaseToolApiWrapper):
|
|
1612
1606
|
The script content as JSON string, or an error message if the script doesn't exist
|
1613
1607
|
"""
|
1614
1608
|
try:
|
1615
|
-
# Get the request
|
1616
|
-
|
1617
|
-
|
1618
|
-
# Get current request to have the latest version with updated scripts
|
1619
|
-
current_request = self._make_request('GET', f'/collections/{self.collection_id}/requests/{request_id}')
|
1620
|
-
request_data = current_request.get("data", {})
|
1609
|
+
# Get the request item from the collection and also try individual endpoint
|
1610
|
+
request_item, request_id, _ = self._get_request_item_and_id(request_path)
|
1621
1611
|
|
1622
|
-
# Find the script by type
|
1623
1612
|
script_content = None
|
1624
|
-
|
1613
|
+
|
1614
|
+
# Method 1: Check events array (modern format)
|
1615
|
+
events = request_item.get("event", [])
|
1616
|
+
for event in events:
|
1625
1617
|
if event.get("listen") == script_type:
|
1626
1618
|
script = event.get("script", {})
|
1627
1619
|
exec_content = script.get("exec", [])
|
@@ -1631,13 +1623,25 @@ class PostmanApiWrapper(BaseToolApiWrapper):
|
|
1631
1623
|
script_content = str(exec_content)
|
1632
1624
|
break
|
1633
1625
|
|
1626
|
+
# Method 2: If not found in events, try individual request endpoint for direct fields
|
1634
1627
|
if script_content is None:
|
1628
|
+
try:
|
1629
|
+
individual_request = self._make_request('GET', f'/collections/{self.collection_id}/requests/{request_id}')
|
1630
|
+
if script_type == "test":
|
1631
|
+
script_content = individual_request.get("tests", "")
|
1632
|
+
elif script_type == "prerequest":
|
1633
|
+
script_content = individual_request.get("preRequestScript", "")
|
1634
|
+
except:
|
1635
|
+
# If individual endpoint fails, that's okay, we'll fall back to not found
|
1636
|
+
pass
|
1637
|
+
|
1638
|
+
if not script_content or script_content.strip() == "":
|
1635
1639
|
return json.dumps({"success": False, "message": f"No {script_type} script found for request '{request_path}'"}, indent=2)
|
1636
1640
|
|
1637
1641
|
return json.dumps({
|
1638
1642
|
"success": True,
|
1639
1643
|
"script_type": script_type,
|
1640
|
-
"script_content": script_content,
|
1644
|
+
"script_content": script_content.strip(),
|
1641
1645
|
"request_path": request_path
|
1642
1646
|
}, indent=2)
|
1643
1647
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.161
|
4
4
|
Summary: SDK for building langchain agents using resources from Alita
|
5
5
|
Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -273,7 +273,7 @@ alita_sdk/tools/pandas/statsmodels/descriptive.py,sha256=APdofBnEiRhMrn6tLKwH076
|
|
273
273
|
alita_sdk/tools/pandas/statsmodels/hypothesis_testing.py,sha256=fdNAayMB3W7avMfKJCcbf2_P54vUXbq8KVebOB48348,10508
|
274
274
|
alita_sdk/tools/pandas/statsmodels/regression.py,sha256=Y1pWK4u_qzrfA740K-FX0nZ5FREGGPk8mfvykPIYoiI,9164
|
275
275
|
alita_sdk/tools/postman/__init__.py,sha256=W0HdtACnTZw6tnzj7_qY_X5RoRyX3czcUSVaZJjBW-Y,4236
|
276
|
-
alita_sdk/tools/postman/api_wrapper.py,sha256=
|
276
|
+
alita_sdk/tools/postman/api_wrapper.py,sha256=DvdZtLPpe6LpsGfsF38UmNyDHjORwWWutisd5AVIogg,78094
|
277
277
|
alita_sdk/tools/postman/postman_analysis.py,sha256=2d-Oi2UORosIePIUyncSONw9hY7dw8Zc7BQvCd4aqpg,45115
|
278
278
|
alita_sdk/tools/pptx/__init__.py,sha256=LNSTQk0BncfdWLXAOGX2WXezG3D4qSEuYwLpokmF9iM,3438
|
279
279
|
alita_sdk/tools/pptx/pptx_wrapper.py,sha256=yyCYcTlIY976kJ4VfPo4dyxj4yeii9j9TWP6W8ZIpN8,29195
|
@@ -317,8 +317,8 @@ alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=Ir3zHljhbZQJRJJQOBzS_GL5
|
|
317
317
|
alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
|
318
318
|
alita_sdk/tools/zephyr_scale/__init__.py,sha256=2NTcdrfkx4GSegqyXhsPLsEpc4FlACuDy85b0fk6cAo,4572
|
319
319
|
alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw2cCDQa-xMOzndE,68663
|
320
|
-
alita_sdk-0.3.
|
321
|
-
alita_sdk-0.3.
|
322
|
-
alita_sdk-0.3.
|
323
|
-
alita_sdk-0.3.
|
324
|
-
alita_sdk-0.3.
|
320
|
+
alita_sdk-0.3.161.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
321
|
+
alita_sdk-0.3.161.dist-info/METADATA,sha256=ybWYeKeLOJiQcnasyPl7i0jE6OTcqEmuVfmid62TT3A,18667
|
322
|
+
alita_sdk-0.3.161.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
323
|
+
alita_sdk-0.3.161.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
324
|
+
alita_sdk-0.3.161.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|