SDK reference · Python SDK
prov.identify.assess
prov.identify.assess in Python SDK. Assess one request (request: method, absolute url, headers): a traffic_assessment.
Signature
prov.identify.assess(request: dict, ip: Optional[str] = …, order: Optional[dict] = …, record: Optional[bool] = …) -> AnyParameters
requestdictRequiredipOptional[str]orderOptional[dict]recordOptional[bool]
Request fields
requestobjectRequired- The request as your server received it.
Show child attributes
methodstringRequired- The HTTP method.
urlstringRequired- The absolute URL the client called.
headersobject- The request headers (at most 100).
bodystring- The request body, when it may hold a protocol object (an AP2 mandate, an ACP completion). Read for this check only and never stored.
protocolsobject- Your own facts for this request's protocol object.
Show child attributes
ap2_expectedobject- Your Checkout:
checkout_jwtorcheckout_hash,payee_id,amount(minor units) andcurrency. Needed to verify an AP2 Checkout Mandate. x402_expectedobject- The payment you advertised (
resource,scheme,network,amount,asset,payTo); the intent token must bind it.
ipstring- The client address. The network is classified on the whole address for this check; only its /24 or /48 prefix is stored, unless your account keeps full addresses.
clientobject- What your own page's script reported about the browser. Never inferred.
Show child attributes
time_zonestring- An IANA time zone (
Europe/Paris). localestring- A BCP 47 language tag (
fr-FR).
orderobject- Your order for this request, when it is a checkout (enables
binding="order"). recordboolean- Record the decision (default true).
challenge_passedboolean- Your own challenge passed this client: for 30 minutes it is never served alternate content (held on its counting keys).
Returns
Any The traffic assessment.
HTTP operation
POST /v1/identify/assessments: Assess a request
Errors
- authentication_required
- invalid_json
- parameter_invalid
- parameter_missing
- policy_account_required
- rate_limit_exceeded
- usage_limit_reached
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/identify/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"request": {
"method": "GET",
"url": "https://harborbean.example/products/house-blend",
"headers": {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6) AppleWebKit/605.1.15",
"accept-language": "en-US"
}
},
"ip": "203.0.113.24",
"client": {
"time_zone": "America/Los_Angeles",
"locale": "en-US"
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/identify/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"request": {
"method": "GET",
"url": "https://harborbean.example/products/house-blend",
"headers": {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6) AppleWebKit/605.1.15",
"accept-language": "en-US"
}
},
"ip": "203.0.113.24",
"client": {
"time_zone": "America/Los_Angeles",
"locale": "en-US"
}
}).json()