Skip to main content

Embargo | Python SDK

The Pangea Embargo API lets developers quickly check IPs and country codes against known sanction and trade embargo lists.

Initializes a new Pangea service client.

Embargo(token, config, logger_name)

str

Pangea API token.

PangeaConfig | None

Configuration.

str

Logger name.

Download file

Embargo.download_file(url, filename)

Download a file from the specified URL and save it with the given filename.

str

URL of the file to download

str | None

Name to save the downloaded file as. If not provided, the filename will be determined from the Content-Disposition header or the URL.

Check IP

Embargo.ip_check(ip)

Check an IP against known sanction and trade embargo lists.

str

Geolocate this IP and check the corresponding country against the enabled embargo lists. Accepts both IPV4 and IPV6 strings.

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API Documentation.

response = embargo.ip_check("190.6.64.94")

ISO Code Check

Embargo.iso_check(iso_code)

Check this country against known sanction and trade embargo lists.

str

Check this two character country ISO-code against the enabled embargo lists.

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API Documentation.

response = embargo.iso_check("CU")

Poll result

Embargo.poll_result(exception)

Returns request's result that has been accepted by the server

Optional[AcceptedRequestException]

Exception that was previously raised by the SDK on a call that is being processed.

PangeaResponse

response = service.poll_result(exception)