score()

PhoneId.score(phone_number, use_case_code, extra=None, timeout=None)

Retrieves a score for the specified phone number. This ranks the phone number’s “risk level” on a scale from 0 to 1000, so you can code your web application to handle particular use cases (e.g., to stop things like chargebacks, identity theft, fraud, and spam).

Parameters  
phone_number The phone number you want details about. You must specify the phone number in its entirety. That is, it must begin with the country code, followed by the area code, and then by the local number. For example, you would specify the phone number (310) 555-1212 as 13105551212.
use_case_code A four letter code used to specify a particular usage scenario for the web service.
timeout (optional) Timeout for the request (see timeout in the requests documentation). Will override any timeout set in the initialization.
extra (optional) Key value mapping of additional parameters.

Use-case Codes

The following table list the available use-case codes (use_case_code), and includes a description of each.

Code Description
BACS Prevent bulk account creation + spam.
BACF Prevent bulk account creation + fraud.
CHBK Prevent chargebacks.
ATCK Prevent account takeover/compromise.
LEAD Prevent false lead entry.
RESV Prevent fake/missed reservations.
PWRT Password reset.
THEF Prevent identity theft.
TELF Prevent telecom fraud.
RXPF Prevent prescription fraud.
OTHR Other.
UNKN Unknown/prefer not to say.

Example:

from telesign.api import PhoneId
from telesign.exceptions import AuthorizationError, TelesignError

cust_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
secret_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
phone_number = "13107409700"
use_case_code = "ATCK"

phoneid = PhoneId(cust_id, secret_key) # Instantiate a PhoneId object.

try:
    score_info = phoneid.score(phone_number, use_case_code)
except AuthorizationError as ex:
    ...
except TelesignError as ex:
    ...