pangea-sdk 5.2.0b1__py3-none-any.whl → 5.2.1__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.
- pangea/__init__.py +1 -1
- pangea/asyncio/request.py +18 -9
- pangea/asyncio/services/audit.py +6 -10
- pangea/asyncio/services/authz.py +23 -2
- pangea/asyncio/services/base.py +21 -2
- pangea/asyncio/services/intel.py +3 -0
- pangea/asyncio/services/redact.py +12 -0
- pangea/asyncio/services/sanitize.py +26 -2
- pangea/asyncio/services/share.py +23 -1
- pangea/deep_verify.py +7 -1
- pangea/dump_audit.py +8 -7
- pangea/request.py +16 -7
- pangea/services/__init__.py +0 -2
- pangea/services/audit/audit.py +5 -10
- pangea/services/authz.py +21 -1
- pangea/services/base.py +16 -2
- pangea/services/intel.py +18 -0
- pangea/services/redact.py +28 -0
- pangea/services/sanitize.py +22 -0
- pangea/services/share/share.py +23 -1
- pangea/utils.py +8 -9
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.1.dist-info}/METADATA +9 -8
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.1.dist-info}/RECORD +24 -28
- pangea/asyncio/services/data_guard.py +0 -65
- pangea/asyncio/services/prompt_guard.py +0 -39
- pangea/services/data_guard.py +0 -147
- pangea/services/prompt_guard.py +0 -48
- {pangea_sdk-5.2.0b1.dist-info → pangea_sdk-5.2.1.dist-info}/WHEEL +0 -0
pangea/services/intel.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
from __future__ import annotations
|
4
|
+
|
3
5
|
import enum
|
4
6
|
import hashlib
|
5
7
|
from typing import Dict, List, Optional
|
@@ -1237,6 +1239,7 @@ class UserBreachedRequest(IntelCommonRequest):
|
|
1237
1239
|
phone_number (str): A phone number to search for. minLength: 7, maxLength: 15.
|
1238
1240
|
start (str): Earliest date for search
|
1239
1241
|
end (str): Latest date for search
|
1242
|
+
cursor (str, optional): A token given in the raw response from SpyCloud. Post this back to paginate results
|
1240
1243
|
"""
|
1241
1244
|
|
1242
1245
|
email: Optional[str] = None
|
@@ -1245,6 +1248,7 @@ class UserBreachedRequest(IntelCommonRequest):
|
|
1245
1248
|
phone_number: Optional[str] = None
|
1246
1249
|
start: Optional[str] = None
|
1247
1250
|
end: Optional[str] = None
|
1251
|
+
cursor: Optional[str] = None
|
1248
1252
|
|
1249
1253
|
|
1250
1254
|
class UserBreachedBulkRequest(IntelCommonRequest):
|
@@ -1387,6 +1391,7 @@ class UserIntel(ServiceBase):
|
|
1387
1391
|
verbose: Optional[bool] = None,
|
1388
1392
|
raw: Optional[bool] = None,
|
1389
1393
|
provider: Optional[str] = None,
|
1394
|
+
cursor: Optional[str] = None,
|
1390
1395
|
) -> PangeaResponse[UserBreachedResult]:
|
1391
1396
|
"""
|
1392
1397
|
Look up breached users
|
@@ -1405,6 +1410,7 @@ class UserIntel(ServiceBase):
|
|
1405
1410
|
verbose (bool, optional): Echo the API parameters in the response
|
1406
1411
|
raw (bool, optional): Include raw data from this provider
|
1407
1412
|
provider (str, optional): Use reputation data from this provider: "spycloud"
|
1413
|
+
cursor (str, optional): A token given in the raw response from SpyCloud. Post this back to paginate results
|
1408
1414
|
|
1409
1415
|
Raises:
|
1410
1416
|
PangeaAPIException: If an API Error happens
|
@@ -1432,6 +1438,7 @@ class UserIntel(ServiceBase):
|
|
1432
1438
|
end=end,
|
1433
1439
|
verbose=verbose,
|
1434
1440
|
raw=raw,
|
1441
|
+
cursor=cursor,
|
1435
1442
|
)
|
1436
1443
|
return self.request.post("v1/user/breached", UserBreachedResult, data=input.model_dump(exclude_none=True))
|
1437
1444
|
|
@@ -1592,6 +1599,17 @@ class UserIntel(ServiceBase):
|
|
1592
1599
|
|
1593
1600
|
@staticmethod
|
1594
1601
|
def is_password_breached(response: PangeaResponse[UserBreachedResult], hash: str) -> PasswordStatus:
|
1602
|
+
"""
|
1603
|
+
Check if a password was breached
|
1604
|
+
|
1605
|
+
Helper function that simplifies searching the response's raw data for
|
1606
|
+
the full hash.
|
1607
|
+
|
1608
|
+
Args:
|
1609
|
+
response: API response from an earlier request
|
1610
|
+
hash: Password hash
|
1611
|
+
"""
|
1612
|
+
|
1595
1613
|
if response.result.raw_data is None: # type: ignore[union-attr]
|
1596
1614
|
raise PangeaException("Need raw data to check if hash is breached. Send request with raw=true")
|
1597
1615
|
|
pangea/services/redact.py
CHANGED
@@ -66,6 +66,17 @@ class RedactRequest(APIRequestModel):
|
|
66
66
|
rulesets: Optional[List[str]] = None
|
67
67
|
return_result: Optional[bool] = None
|
68
68
|
redaction_method_overrides: Optional[RedactionMethodOverrides] = None
|
69
|
+
vault_parameters: Optional[VaultParameters] = None
|
70
|
+
llm_request: Optional[bool] = None
|
71
|
+
"""Is this redact call going to be used in an LLM request?"""
|
72
|
+
|
73
|
+
|
74
|
+
class VaultParameters(APIRequestModel):
|
75
|
+
fpe_key_id: Optional[str] = None
|
76
|
+
"""A vault key ID of an exportable key used to redact with FPE instead of using the service config default."""
|
77
|
+
|
78
|
+
salt_secret_id: Optional[str] = None
|
79
|
+
"""A vault secret ID of a secret used to salt a hash instead of using the service config default."""
|
69
80
|
|
70
81
|
|
71
82
|
class RecognizerResult(APIResponseModel):
|
@@ -108,11 +119,13 @@ class RedactResult(PangeaResponseResult):
|
|
108
119
|
redact_text: Redacted text result
|
109
120
|
count: Number of redactions present in the text
|
110
121
|
report: Describes the decision process for redactions
|
122
|
+
fpe_context: FPE context used to encrypt and redact data
|
111
123
|
"""
|
112
124
|
|
113
125
|
redacted_text: Optional[str] = None
|
114
126
|
count: int
|
115
127
|
report: Optional[DebugReport] = None
|
128
|
+
fpe_context: Optional[str] = None
|
116
129
|
|
117
130
|
|
118
131
|
class StructuredRequest(APIRequestModel):
|
@@ -134,6 +147,9 @@ class StructuredRequest(APIRequestModel):
|
|
134
147
|
rulesets: Optional[List[str]] = None
|
135
148
|
return_result: Optional[bool] = None
|
136
149
|
redaction_method_overrides: Optional[RedactionMethodOverrides] = None
|
150
|
+
vault_parameters: Optional[VaultParameters] = None
|
151
|
+
llm_request: Optional[bool] = None
|
152
|
+
"""Is this redact call going to be used in an LLM request?"""
|
137
153
|
|
138
154
|
|
139
155
|
class StructuredResult(PangeaResponseResult):
|
@@ -228,6 +244,8 @@ class Redact(ServiceBase):
|
|
228
244
|
rulesets: Optional[List[str]] = None,
|
229
245
|
return_result: Optional[bool] = None,
|
230
246
|
redaction_method_overrides: Optional[RedactionMethodOverrides] = None,
|
247
|
+
llm_request: Optional[bool] = None,
|
248
|
+
vault_parameters: Optional[VaultParameters] = None,
|
231
249
|
) -> PangeaResponse[RedactResult]:
|
232
250
|
"""
|
233
251
|
Redact
|
@@ -244,6 +262,8 @@ class Redact(ServiceBase):
|
|
244
262
|
rulesets (list[str], optional): An array of redact rulesets short names
|
245
263
|
return_result(bool, optional): Setting this value to false will omit the redacted result only returning count
|
246
264
|
redaction_method_overrides: A set of redaction method overrides for any enabled rule. These methods override the config declared methods
|
265
|
+
llm_request: Boolean flag to enable FPE redaction for LLM requests
|
266
|
+
vault_parameters: A set of vault parameters to use for redaction
|
247
267
|
|
248
268
|
Raises:
|
249
269
|
PangeaAPIException: If an API Error happens
|
@@ -264,6 +284,8 @@ class Redact(ServiceBase):
|
|
264
284
|
rulesets=rulesets,
|
265
285
|
return_result=return_result,
|
266
286
|
redaction_method_overrides=redaction_method_overrides,
|
287
|
+
llm_request=llm_request,
|
288
|
+
vault_parameters=vault_parameters,
|
267
289
|
)
|
268
290
|
return self.request.post("v1/redact", RedactResult, data=input.model_dump(exclude_none=True))
|
269
291
|
|
@@ -277,6 +299,8 @@ class Redact(ServiceBase):
|
|
277
299
|
rulesets: Optional[List[str]] = None,
|
278
300
|
return_result: Optional[bool] = None,
|
279
301
|
redaction_method_overrides: Optional[RedactionMethodOverrides] = None,
|
302
|
+
llm_request: Optional[bool] = None,
|
303
|
+
vault_parameters: Optional[VaultParameters] = None,
|
280
304
|
) -> PangeaResponse[StructuredResult]:
|
281
305
|
"""
|
282
306
|
Redact structured
|
@@ -297,6 +321,8 @@ class Redact(ServiceBase):
|
|
297
321
|
rulesets (list[str], optional): An array of redact rulesets short names
|
298
322
|
return_result(bool, optional): Setting this value to false will omit the redacted result only returning count
|
299
323
|
redaction_method_overrides: A set of redaction method overrides for any enabled rule. These methods override the config declared methods
|
324
|
+
llm_request: Boolean flag to enable FPE redaction for LLM requests
|
325
|
+
vault_parameters: A set of vault parameters to use for redaction
|
300
326
|
|
301
327
|
Raises:
|
302
328
|
PangeaAPIException: If an API Error happens
|
@@ -324,6 +350,8 @@ class Redact(ServiceBase):
|
|
324
350
|
rulesets=rulesets,
|
325
351
|
return_result=return_result,
|
326
352
|
redaction_method_overrides=redaction_method_overrides,
|
353
|
+
llm_request=llm_request,
|
354
|
+
vault_parameters=vault_parameters,
|
327
355
|
)
|
328
356
|
return self.request.post("v1/redact_structured", StructuredResult, data=input.model_dump(exclude_none=True))
|
329
357
|
|
pangea/services/sanitize.py
CHANGED
@@ -7,6 +7,7 @@ from typing import Dict, List, Optional, Tuple
|
|
7
7
|
|
8
8
|
from pydantic import Field
|
9
9
|
|
10
|
+
from pangea.config import PangeaConfig
|
10
11
|
from pangea.response import APIRequestModel, PangeaResponse, PangeaResponseResult, TransferMethod
|
11
12
|
from pangea.services.base import ServiceBase
|
12
13
|
from pangea.utils import FileUploadParams, get_file_upload_params
|
@@ -197,6 +198,27 @@ class Sanitize(ServiceBase):
|
|
197
198
|
|
198
199
|
service_name = "sanitize"
|
199
200
|
|
201
|
+
def __init__(
|
202
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
203
|
+
) -> None:
|
204
|
+
"""
|
205
|
+
Sanitize client
|
206
|
+
|
207
|
+
Initializes a new Sanitize client.
|
208
|
+
|
209
|
+
Args:
|
210
|
+
token: Pangea API token.
|
211
|
+
config: Configuration.
|
212
|
+
logger_name: Logger name.
|
213
|
+
config_id: Configuration ID.
|
214
|
+
|
215
|
+
Examples:
|
216
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
217
|
+
authz = Sanitize(token="pangea_token", config=config)
|
218
|
+
"""
|
219
|
+
|
220
|
+
super().__init__(token, config, logger_name, config_id=config_id)
|
221
|
+
|
200
222
|
def sanitize(
|
201
223
|
self,
|
202
224
|
transfer_method: TransferMethod = TransferMethod.POST_URL,
|
pangea/services/share/share.py
CHANGED
@@ -6,6 +6,7 @@ import enum
|
|
6
6
|
import io
|
7
7
|
from typing import Dict, List, NewType, Optional, Tuple, Union
|
8
8
|
|
9
|
+
from pangea.config import PangeaConfig
|
9
10
|
from pangea.response import APIRequestModel, PangeaResponse, PangeaResponseResult, TransferMethod
|
10
11
|
from pangea.services.base import ServiceBase
|
11
12
|
from pangea.services.share.file_format import FileFormat
|
@@ -669,10 +670,31 @@ class BucketsResult(PangeaResponseResult):
|
|
669
670
|
|
670
671
|
|
671
672
|
class Share(ServiceBase):
|
672
|
-
"""Share service client."""
|
673
|
+
"""Secure Share service client."""
|
673
674
|
|
674
675
|
service_name = "share"
|
675
676
|
|
677
|
+
def __init__(
|
678
|
+
self, token: str, config: PangeaConfig | None = None, logger_name: str = "pangea", config_id: str | None = None
|
679
|
+
) -> None:
|
680
|
+
"""
|
681
|
+
Secure Share client
|
682
|
+
|
683
|
+
Initializes a new Secure Share client.
|
684
|
+
|
685
|
+
Args:
|
686
|
+
token: Pangea API token.
|
687
|
+
config: Configuration.
|
688
|
+
logger_name: Logger name.
|
689
|
+
config_id: Configuration ID.
|
690
|
+
|
691
|
+
Examples:
|
692
|
+
config = PangeaConfig(domain="aws.us.pangea.cloud")
|
693
|
+
authz = Share(token="pangea_token", config=config)
|
694
|
+
"""
|
695
|
+
|
696
|
+
super().__init__(token, config, logger_name, config_id=config_id)
|
697
|
+
|
676
698
|
def buckets(self) -> PangeaResponse[BucketsResult]:
|
677
699
|
"""
|
678
700
|
Buckets
|
pangea/utils.py
CHANGED
@@ -6,7 +6,6 @@ import datetime
|
|
6
6
|
import io
|
7
7
|
import json
|
8
8
|
from hashlib import md5, new, sha1, sha256, sha512
|
9
|
-
from typing import Union
|
10
9
|
|
11
10
|
from google_crc32c import Checksum as CRC32C
|
12
11
|
from pydantic import BaseModel
|
@@ -67,7 +66,7 @@ def canonicalize(data: dict) -> str:
|
|
67
66
|
return str(data)
|
68
67
|
|
69
68
|
|
70
|
-
def hash_sha256(input:
|
69
|
+
def hash_sha256(input: str | io.BufferedReader) -> str:
|
71
70
|
# Return SHA256 hash in hex format
|
72
71
|
hash = sha256()
|
73
72
|
if isinstance(input, io.BufferedReader):
|
@@ -80,12 +79,12 @@ def hash_sha256(input: Union[str, io.BufferedReader]) -> str:
|
|
80
79
|
|
81
80
|
input.seek(0) # restart reading
|
82
81
|
else:
|
83
|
-
hash.update(input)
|
82
|
+
hash.update(input.encode("utf-8"))
|
84
83
|
|
85
84
|
return hash.hexdigest()
|
86
85
|
|
87
86
|
|
88
|
-
def hash_sha1(input:
|
87
|
+
def hash_sha1(input: str | io.BufferedReader) -> str:
|
89
88
|
# Return SHA1 hash in hex format
|
90
89
|
hash = sha1()
|
91
90
|
if isinstance(input, io.BufferedReader):
|
@@ -98,12 +97,12 @@ def hash_sha1(input: Union[str, io.BufferedReader]) -> str:
|
|
98
97
|
|
99
98
|
input.seek(0) # restart reading
|
100
99
|
else:
|
101
|
-
hash.update(input)
|
100
|
+
hash.update(input.encode("utf-8"))
|
102
101
|
|
103
102
|
return hash.hexdigest()
|
104
103
|
|
105
104
|
|
106
|
-
def hash_sha512(input:
|
105
|
+
def hash_sha512(input: str | io.BufferedReader) -> str:
|
107
106
|
# Return SHA512 hash in hex format
|
108
107
|
hash = sha512()
|
109
108
|
if isinstance(input, io.BufferedReader):
|
@@ -116,7 +115,7 @@ def hash_sha512(input: Union[str, io.BufferedReader]) -> str:
|
|
116
115
|
|
117
116
|
input.seek(0) # restart reading
|
118
117
|
else:
|
119
|
-
hash.update(input)
|
118
|
+
hash.update(input.encode("utf-8"))
|
120
119
|
|
121
120
|
return hash.hexdigest()
|
122
121
|
|
@@ -126,7 +125,7 @@ def hash_ntlm(data: str) -> str:
|
|
126
125
|
return new("md4", data.encode("utf-16le")).hexdigest()
|
127
126
|
|
128
127
|
|
129
|
-
def hash_md5(input:
|
128
|
+
def hash_md5(input: str | io.BufferedReader) -> str:
|
130
129
|
# Return MD5 hash in hex format
|
131
130
|
hash = md5()
|
132
131
|
if isinstance(input, io.BufferedReader):
|
@@ -140,7 +139,7 @@ def hash_md5(input: Union[str, io.BufferedReader]) -> str:
|
|
140
139
|
|
141
140
|
input.seek(0) # restart reading
|
142
141
|
else:
|
143
|
-
hash.update(input)
|
142
|
+
hash.update(input.encode("utf-8"))
|
144
143
|
|
145
144
|
return hash.hexdigest()
|
146
145
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pangea-sdk
|
3
|
-
Version: 5.2.
|
3
|
+
Version: 5.2.1
|
4
4
|
Summary: Pangea API SDK
|
5
5
|
Home-page: https://pangea.cloud/docs/sdk/python/
|
6
6
|
License: MIT
|
@@ -17,11 +17,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
18
18
|
Classifier: Topic :: Software Development
|
19
19
|
Classifier: Topic :: Software Development :: Libraries
|
20
|
-
Requires-Dist: aiohttp (>=3.
|
21
|
-
Requires-Dist: cryptography (>=43.0.
|
22
|
-
Requires-Dist: deprecated (>=1.2.
|
20
|
+
Requires-Dist: aiohttp (>=3.11.10,<4.0.0)
|
21
|
+
Requires-Dist: cryptography (>=43.0.3,<44.0.0)
|
22
|
+
Requires-Dist: deprecated (>=1.2.15,<2.0.0)
|
23
23
|
Requires-Dist: google-crc32c (>=1.5.0,<2.0.0)
|
24
|
-
Requires-Dist: pydantic (>=2.
|
24
|
+
Requires-Dist: pydantic (>=2.10.3,<3.0.0)
|
25
25
|
Requires-Dist: python-dateutil (>=2.9.0,<3.0.0)
|
26
26
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
27
27
|
Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
|
@@ -64,9 +64,10 @@ $ poetry add pangea-sdk
|
|
64
64
|
#### Beta releases
|
65
65
|
|
66
66
|
Pre-release versions may be available with the `b` (beta) denotation in the
|
67
|
-
version number. These releases serve to preview
|
68
|
-
Semantic Versioning, they are considered unstable and do not carry
|
69
|
-
compatibility guarantees as stable releases.
|
67
|
+
version number. These releases serve to preview Beta and Early Access services
|
68
|
+
and APIs. Per Semantic Versioning, they are considered unstable and do not carry
|
69
|
+
the same compatibility guarantees as stable releases.
|
70
|
+
[Beta changelog](https://github.com/pangeacyber/pangea-python/blob/beta/CHANGELOG.md).
|
70
71
|
|
71
72
|
Via pip:
|
72
73
|
|
@@ -1,51 +1,47 @@
|
|
1
|
-
pangea/__init__.py,sha256=
|
1
|
+
pangea/__init__.py,sha256=YdVCSgR-OBewhxnne1SnOliwM7KXiu_EV88j_zSLRmM,246
|
2
2
|
pangea/asyncio/__init__.py,sha256=kjEMkqMQ521LlMSu5jn3_WgweyArwVZ2C-s3x7mR6Pk,45
|
3
3
|
pangea/asyncio/file_uploader.py,sha256=wI7epib7Rc5jtZw4eJ1L1SlmutDG6CPv59C8N2UPhtY,1436
|
4
|
-
pangea/asyncio/request.py,sha256=
|
4
|
+
pangea/asyncio/request.py,sha256=BREsLY8_MCxGSplHbdKFZTzr4TX5ya0-BsXLffZhsco,17849
|
5
5
|
pangea/asyncio/services/__init__.py,sha256=3IkiTqY_RtFndI7aoDTrb1yLv8xos_cKhmGS1TULcmw,386
|
6
|
-
pangea/asyncio/services/audit.py,sha256=
|
6
|
+
pangea/asyncio/services/audit.py,sha256=rPaCx4cMzj-g9WFMRIysFCJAz6Btp6YrhcKe_exky8k,26283
|
7
7
|
pangea/asyncio/services/authn.py,sha256=rPeLJweL8mYH_t4ebcQn4n_Wglr3kClKNnCXNCimZU4,46622
|
8
|
-
pangea/asyncio/services/authz.py,sha256=
|
9
|
-
pangea/asyncio/services/base.py,sha256=
|
10
|
-
pangea/asyncio/services/data_guard.py,sha256=f6VzZCcfAHpttCjqt5SExtbsrH1HkIRFmZ2c3nRlcwU,1713
|
8
|
+
pangea/asyncio/services/authz.py,sha256=B_0_nhDMJcjNpjpCx3Vi2LDRhlmfV9325GKbUZ8reos,10025
|
9
|
+
pangea/asyncio/services/base.py,sha256=vRFVcO_uEAGJte3OUUBLD43RoiiFB1vC7SPyN6yEMoA,3158
|
11
10
|
pangea/asyncio/services/embargo.py,sha256=ctzj3kip6xos-Eu3JuOskrCGYC8T3JlsgAopZHiPSXM,3068
|
12
11
|
pangea/asyncio/services/file_scan.py,sha256=PLG1O-PL4Yk9uY9D6NbMrZ5LHg70Z311s7bFe46UMZA,7108
|
13
|
-
pangea/asyncio/services/intel.py,sha256=
|
14
|
-
pangea/asyncio/services/
|
15
|
-
pangea/asyncio/services/
|
16
|
-
pangea/asyncio/services/
|
17
|
-
pangea/asyncio/services/share.py,sha256=UYJeUKA3NLSFA8R0X7B6yBi2U1g4q04O4ftrp9SMCzA,26097
|
12
|
+
pangea/asyncio/services/intel.py,sha256=Iwz_DleAPtmd1taekT4W8lVo65uHjIvA4TQ7WUQGrRk,38306
|
13
|
+
pangea/asyncio/services/redact.py,sha256=JPJcmeKFloMZRpkjAHAZbpZJpO993WsTfEwA-S5ov18,7951
|
14
|
+
pangea/asyncio/services/sanitize.py,sha256=4pRWBH595kFUXBkmu8euyk6H7F1M_-xXB2Qxnz6St6c,8627
|
15
|
+
pangea/asyncio/services/share.py,sha256=YPJm_Gc4tfcx2cX6P_vLWIsHOR6M3RYy9LdU2UzEZbk,26791
|
18
16
|
pangea/asyncio/services/vault.py,sha256=VqrJGSEdq6MlZRI6cJpkthhIsqLClSQdgVxwYCbIwEk,77079
|
19
17
|
pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
|
20
18
|
pangea/config.py,sha256=mQUu8GX_6weIuv3vjNdG5plppXskXYASmxMWtFQh-hc,1662
|
21
19
|
pangea/crypto/rsa.py,sha256=mwSiNy571KAGr3F6oEM0CXWkl9D023ch8ldbZZeLj_4,4747
|
22
|
-
pangea/deep_verify.py,sha256=
|
20
|
+
pangea/deep_verify.py,sha256=ZGraaL7TCxwRBIDqjBFR0clKlhAC-Yce6kD-1LClhG8,8616
|
23
21
|
pangea/deprecated.py,sha256=IjFYEVvY1E0ld0SMkEYC1o62MAleX3nnT1If2dFVbHo,608
|
24
|
-
pangea/dump_audit.py,sha256=
|
22
|
+
pangea/dump_audit.py,sha256=IevqaUUh7GDepdIW7slSxeZbkPrWIVbcX3sr4DgpJXI,7090
|
25
23
|
pangea/exceptions.py,sha256=OBtzUECpNa6vNp8ySkHC-tm4QjFRCOAHBkMHqzAlOu8,5656
|
26
24
|
pangea/file_uploader.py,sha256=4RQ44xt-faApC61nn2PlwHT7XYrJ4GeQA8Ug4tySEAg,1227
|
27
25
|
pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
-
pangea/request.py,sha256=
|
26
|
+
pangea/request.py,sha256=zxFvqbeGYtxN29nS8SPPZKlcGCqdUtenxaq84pQ4cxs,24807
|
29
27
|
pangea/response.py,sha256=lPAcYsF9Xg166CiyhCofVmQA-W4jevh0MQXxUa8Re68,7737
|
30
|
-
pangea/services/__init__.py,sha256
|
31
|
-
pangea/services/audit/audit.py,sha256=
|
28
|
+
pangea/services/__init__.py,sha256=-QsZxRzRq_V1x1lmS_mu4310MNm0DkM4r6g6rfVGnOc,340
|
29
|
+
pangea/services/audit/audit.py,sha256=7-c9l7jyGtpG7SqRUMpqsAzcUDhMZ5izgPalxHXsUvM,39320
|
32
30
|
pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
|
33
31
|
pangea/services/audit/models.py,sha256=1h1B9eSYQMYG3f8WNi1UcDX2-impRrET_ErjJYUnj7M,14678
|
34
32
|
pangea/services/audit/signing.py,sha256=5A4hvPtpfP2kMz8bsiiKUACriXbh5dv9gb_rbqiUtuI,5583
|
35
33
|
pangea/services/audit/util.py,sha256=Zq1qvfeplYfhCP_ud5YMvntSB0UvnCdsuYbOzZkHbjg,7620
|
36
34
|
pangea/services/authn/authn.py,sha256=cZKl2Ixc6HwHnkRecpSaAGTQUgaZUtxfLa0T3S03HMs,45478
|
37
35
|
pangea/services/authn/models.py,sha256=HH5su6jx3O9AwVGzASXZ99-eIWjgXEP5LhIVdewM13s,22394
|
38
|
-
pangea/services/authz.py,sha256=
|
39
|
-
pangea/services/base.py,sha256=
|
40
|
-
pangea/services/data_guard.py,sha256=CzJ4Q-aakmWm8NhaWNWkT0QA6zFlyY49j2yerGOPUmc,3689
|
36
|
+
pangea/services/authz.py,sha256=bB0ZEUuXLT7Xjs5kZef1hZK6Du6VUusHe5aekNaxamw,12746
|
37
|
+
pangea/services/base.py,sha256=43pWQcR9CeT4sGzgctF3Sy4M_h7DaUzkuZD2Z7CcDUU,3845
|
41
38
|
pangea/services/embargo.py,sha256=9Wfku4td5ORaIENKmnGmS5jxJJIRfWp6Q51L36Jsy0I,3897
|
42
39
|
pangea/services/file_scan.py,sha256=QiO80uKqB_BnAOiYQKznXfxpa5j40qqETE3-zBRT_QE,7813
|
43
|
-
pangea/services/intel.py,sha256=
|
44
|
-
pangea/services/
|
45
|
-
pangea/services/
|
46
|
-
pangea/services/sanitize.py,sha256=XP5D4CcbCZfzgU567X6H5eFBWwZuYSsHdvsdrQAZekY,12767
|
40
|
+
pangea/services/intel.py,sha256=flVdK4WhllPutCkWh7H-MuBxMMz0f4Bl-fz2f-hPuWM,52679
|
41
|
+
pangea/services/redact.py,sha256=ovIcT0jkXe57O7keGzSClWNCic8y-4NZoemXoSKjjww,12913
|
42
|
+
pangea/services/sanitize.py,sha256=D_R_XIe9FvRCX40b8b_3gouhAGduDdxI9bT2w-kiVHU,13444
|
47
43
|
pangea/services/share/file_format.py,sha256=1svO1ee_aenA9zoO_AaU-Rk5Ulp7kcPOc_KwNoluyQE,2797
|
48
|
-
pangea/services/share/share.py,sha256=
|
44
|
+
pangea/services/share/share.py,sha256=8N4zXQJjkVDf2iR62pz6xpmxlbXRPNfHgYfOuEdNaZ8,46333
|
49
45
|
pangea/services/vault/models/asymmetric.py,sha256=vspijmEvHm5WXri_fjOWfQc4maYyZfhDkLuaTM8-PZo,4991
|
50
46
|
pangea/services/vault/models/common.py,sha256=PSZRFqHTUtEMJJGwywEFM2AU3aV8S-sbcoo3LLQ6uTc,17981
|
51
47
|
pangea/services/vault/models/keys.py,sha256=duAuTiOby_D7MloRvN4gNj0P-b-jx9sdtplAWFxsShw,2786
|
@@ -53,8 +49,8 @@ pangea/services/vault/models/secret.py,sha256=ItGdkulM-SEySfcm4a5yGxMvo_omjC7kCh
|
|
53
49
|
pangea/services/vault/models/symmetric.py,sha256=t8xCM1wGGKDBpOqTggFueO4-4-2IFmyxqcs7_PDr7U0,2562
|
54
50
|
pangea/services/vault/vault.py,sha256=ow-Zm7PYzfWIfUcA4UNnpeL2DHfZM4C7inRDmNR3zQU,76196
|
55
51
|
pangea/tools.py,sha256=2-Y4SAHWFv6Ocj42J_bWrVy27M5G3wi7a8LJn0dabHc,6427
|
56
|
-
pangea/utils.py,sha256=
|
52
|
+
pangea/utils.py,sha256=dZ6MwFVEWXUgXvvDg-k6JnvVfsgslvtaBd7ez7afrqk,4983
|
57
53
|
pangea/verify_audit.py,sha256=nSP17OzoSPdvezRExwfcf45H8ZPZnxZu-CbEp3qFJO0,17354
|
58
|
-
pangea_sdk-5.2.
|
59
|
-
pangea_sdk-5.2.
|
60
|
-
pangea_sdk-5.2.
|
54
|
+
pangea_sdk-5.2.1.dist-info/METADATA,sha256=YjlZ9hj9YmyyMIeS6Z_eSbpBeHsh_QNfzwxfbexlZVs,7513
|
55
|
+
pangea_sdk-5.2.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
56
|
+
pangea_sdk-5.2.1.dist-info/RECORD,,
|
@@ -1,65 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from pangea.asyncio.services.base import ServiceBaseAsync
|
4
|
-
from pangea.response import PangeaResponse, PangeaResponseResult
|
5
|
-
from pangea.services.data_guard import TextGuardResult
|
6
|
-
|
7
|
-
|
8
|
-
class DataGuard(ServiceBaseAsync):
|
9
|
-
"""Data Guard service client.
|
10
|
-
|
11
|
-
Provides methods to interact with Pangea's Data Guard service.
|
12
|
-
"""
|
13
|
-
|
14
|
-
service_name = "data-guard"
|
15
|
-
|
16
|
-
async def guard_text(
|
17
|
-
self,
|
18
|
-
text: str,
|
19
|
-
*,
|
20
|
-
recipe: str = "pangea_prompt_guard",
|
21
|
-
debug: bool = False,
|
22
|
-
) -> PangeaResponse[TextGuardResult]:
|
23
|
-
"""
|
24
|
-
Text guard (Beta)
|
25
|
-
|
26
|
-
Guard text.
|
27
|
-
|
28
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
29
|
-
|
30
|
-
OperationId: data_guard_post_v1_text_guard
|
31
|
-
|
32
|
-
Args:
|
33
|
-
text: Text.
|
34
|
-
recipe: Recipe.
|
35
|
-
debug: Debug.
|
36
|
-
|
37
|
-
Examples:
|
38
|
-
response = await data_guard.guard_text("text")
|
39
|
-
"""
|
40
|
-
|
41
|
-
return await self.request.post(
|
42
|
-
"v1/text/guard", TextGuardResult, data={"text": text, "recipe": recipe, "debug": debug}
|
43
|
-
)
|
44
|
-
|
45
|
-
async def guard_file(
|
46
|
-
self,
|
47
|
-
file_url: str,
|
48
|
-
) -> PangeaResponse[PangeaResponseResult]:
|
49
|
-
"""
|
50
|
-
File guard (Beta)
|
51
|
-
|
52
|
-
Guard a file URL.
|
53
|
-
|
54
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
55
|
-
|
56
|
-
OperationId: data_guard_post_v1_file_guard
|
57
|
-
|
58
|
-
Args:
|
59
|
-
file_url: File URL.
|
60
|
-
|
61
|
-
Examples:
|
62
|
-
response = await data_guard.guard_file("https://example.org/file.txt")
|
63
|
-
"""
|
64
|
-
|
65
|
-
return await self.request.post("v1/file/guard", PangeaResponseResult, data={"file_url": file_url})
|
@@ -1,39 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from typing import TYPE_CHECKING
|
4
|
-
|
5
|
-
from pangea.asyncio.services.base import ServiceBaseAsync
|
6
|
-
from pangea.services.prompt_guard import GuardResult, Message
|
7
|
-
|
8
|
-
if TYPE_CHECKING:
|
9
|
-
from collections.abc import Iterable
|
10
|
-
|
11
|
-
from pangea.response import PangeaResponse
|
12
|
-
|
13
|
-
|
14
|
-
class PromptGuard(ServiceBaseAsync):
|
15
|
-
"""Prompt Guard service client.
|
16
|
-
|
17
|
-
Provides methods to interact with Pangea's Prompt Guard service.
|
18
|
-
"""
|
19
|
-
|
20
|
-
service_name = "prompt-guard"
|
21
|
-
|
22
|
-
async def guard(self, messages: Iterable[Message]) -> PangeaResponse[GuardResult]:
|
23
|
-
"""
|
24
|
-
Guard (Beta)
|
25
|
-
|
26
|
-
Guard messages.
|
27
|
-
|
28
|
-
How to install a [Beta release](https://pangea.cloud/docs/sdk/python/#beta-releases).
|
29
|
-
|
30
|
-
OperationId: prompt_guard_post_v1_guard
|
31
|
-
|
32
|
-
Args:
|
33
|
-
messages: Messages..
|
34
|
-
|
35
|
-
Examples:
|
36
|
-
response = await prompt_guard.guard([Message(role="user", content="hello world")])
|
37
|
-
"""
|
38
|
-
|
39
|
-
return await self.request.post("v1/guard", GuardResult, data={"messages": messages})
|