This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 1.0.3 instead.
Reason given by maintainers: Use 1.0.2+: should_block is canonical; upgrade recommended.
PrimeGuardia Python SDK
Official Python client for PrimeGuardia’s sanctions screening API.
PyPI package: primeguardia
Install
pip install primeguardia
from primeguardia import PrimeGuardia
client = PrimeGuardia(api_key="your-api-key-here")
Default base URL: https://api.primeguardia.com. Auth header: X-API-Key.
What production actually does
- Screening is warn, not hard-block. HTTP 200,
blocked=False. Useshould_block. - Live
POST /api/screendoes not sendmatches[]orrisk_assessment.ScreeningResult.from_apifillsmatchesfromdataand derivesrisk_assessment. - The API uses
name,email, andbirth_date/dob.countryandmetadataare sent by the SDK but ignored by the API. - Bulk screens names only. Passing
emails=does not screen those emails. - Search is a name/email
ILIKElookup.limitandsourcesare ignored. A miss is HTTP 404; the SDK returns an emptySearchResponseinstead of raising. - Datasets are list-file rows (
fileName→dataset.name). The API does not send record counts;record_countis0.
Screen (the method customers use)
result = client.screen(name="Vladimir Putin")
if result.should_block:
print("SHOULD BE BLOCKED — review required")
print(result.match_category) # e.g. "sanctions"
print(result.risk_assessment) # "HIGH" (derived)
print(result.matches[0].name) # from data.name
print(result.data["matched_sources"])
else:
print("Clear")
Optional DOB (the engine compares year):
client.screen(name="John Smith", date_of_birth="1980-01-01")
Context manager closes the HTTP client:
with PrimeGuardia(api_key="your-key") as client:
result = client.screen(name="John Doe")
print(result.should_block, result.risk_assessment)
Bulk screen
results = client.bulk_screen(names=["Vladimir Putin", "Zorblax Quennerthwaite"])
print(results.processed, results.processing_time_ms)
print(results.high_risk_count, results.matches_count)
for row in results.results:
if row.should_block:
print(row.name, row.risk_level) # "Vladimir Putin" "HIGH"
Search and entity
found = client.search(query="Vladimir Putin")
print(found.total, found.results[0].name, found.results[0].source_dataset)
miss = client.search(query="ZxqqqUniqueNobody918273")
# miss.total == 0, miss.results == [] (prod 404, not an exception)
entity = client.get_entity(4242)
print(entity.name, entity.source_dataset)
Search is not the same engine as screen(). It can return PEP/crime clones for a name that screen() ranks as OFAC.
has_more is only meaningful if the API sent pagination; live search does not, so it stays false.
Account
profile = client.get_profile()
print(profile.client_name, profile.tier, profile.subscription_status)
print(profile.usage_percentage, profile.is_active)
quota = client.get_quota_status()
print(quota.used, quota.limit, quota.remaining, quota.percentage)
get_quota_status() calls GET /api/status (usage / quota on the wire). The SDK maps those to used / limit.
Monitoring
monitored = client.add_monitoring(
name="Acme Holdings Ltd",
frequency=24, # sent as check_frequency="daily"
)
print(monitored.id, monitored.name)
entities = client.get_monitored_entities() # list (unwraps { "entities": [...] })
Prod add expects entity_name. Pass SDK name; the client maps it.
The sync client does not wrap getAlerts / getMonitoringStats. Use the HTTP API directly if you need those.
Datasets
datasets = client.get_datasets()
print(datasets[0].name) # e.g. "eu_sanctions_2026_08_27.csv"
Async client
AsyncPrimeGuardia only implements screen, bulk_screen, get_profile, and test_connection. Other methods are sync-only.
import asyncio
from primeguardia import AsyncPrimeGuardia
async def main():
async with AsyncPrimeGuardia(api_key="your-key") as client:
result = await client.screen(name="Vladimir Putin")
print(result.should_block, result.risk_assessment)
asyncio.run(main())
Errors
from primeguardia import (
PrimeGuardia,
AuthenticationError,
QuotaExceededError,
RateLimitError,
ValidationError,
PrimeGuardiaError,
)
client = PrimeGuardia(api_key="your-key")
try:
client.screen(name="John Doe")
except AuthenticationError:
print("401 — missing/invalid key on some paths")
except QuotaExceededError:
print("429 with quota in the message")
except RateLimitError as e:
print("other 429", e.retry_after)
except ValidationError as e:
print("400", e)
except PrimeGuardiaError as e:
print(e.status_code, e)
Prod returns 403 INVALID_API_KEY for a key that is not in the database (not 401). That becomes PrimeGuardiaError, not AuthenticationError. An empty api_key= to the constructor raises ValidationError before any request.
Config
PrimeGuardia(
api_key="your-api-key",
base_url="https://api.primeguardia.com",
timeout=30.0, # seconds
max_retries=3, # httpx transport retries
)
Methods that exist (sync)
| Method | Prod path | Notes |
|---|---|---|
screen |
POST /api/screen |
Use should_block |
bulk_screen |
POST /api/sanctions/bulk-search |
Names only |
search |
GET /api/sanctions/search |
404 miss → empty |
get_entity |
GET /api/sanctions/entity/:id |
Raw entity row |
get_datasets |
GET /api/sanctions/datasets |
Filename list |
get_profile |
GET /api/settings/profile |
Unwraps { "client": … } |
get_quota_status |
GET /api/status |
Maps usage/quota |
add_monitoring / get_monitored_entities |
/api/monitoring/entities |
Maps name → entity_name |
test_connection |
profile GET |
Tests
cd sdks/python
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
Support
- Email: support@primeguardia.com
- Site: https://primeguardia.com
MIT © PrimeGuardia
Release files for primeguardia 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| primeguardia-1.0.1.tar.gz | 19.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| primeguardia-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.7 kB
Release files / primeguardia-1.0.1.tar.gz
| Download URL | primeguardia-1.0.1.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
173268af54b6e71d9478e0b8def7559fb3d85b8940e0c0aa6114d4532cefae0e
|
|
BLAKE2b-256 checksum How to use checksums |
9a39571be67640ca91c3ebbcb278df2f149d36c4e5f26be8ff0560dc8fabb247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / primeguardia-1.0.1-py3-none-any.whl
| Download URL | primeguardia-1.0.1-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c38d57fc1e76ea3195fb1452d3e79a690dff5686fa46a4478e91af8b73674ba3
|
|
BLAKE2b-256 checksum How to use checksums |
ae38d9f0e17f9464204939e3a9551055ead0f064ebbea43f8e94aa8eee631c99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|