RealValidation API Reference¶
Application Object¶
-
class
realvalidation.
RealValidation
(workbooks=None, token=None, output='json', url='https://api.realvalidation.com/rpvWebService/DNCLookup.php', phone_regex='^\d{10}$', staging=False)[source]¶ RealValidation Application Object
Parameters: - workbooks (list) – List of workbook paths to validate against RealValidation DNC API
- token (str) – RealValidation API Token. Defaults to environmental variable
RV_TOKEN
- output (str) – RealValidation API Output. Defaults to
json
- url (str) – RealValidation API URL. Defaults to
https://api.realvalidation.com/rpvWebService/DNCLookup.php
- phone_regex (str) – Regex to use when validating phone numbers. Defaults to
r'^\d{10}$'
- staging (bool) – If
True
RealValidation utilizes the Mock API, overridesurl
parameter
-
lookup_phone
(phone)[source]¶ Makes a request to the RealValidation DNC API
Parameters: phone (str) – 10 numerical digits representing a phone number. Returns: Dictionary representing JSON response from RealValidation DNC API. Return type: dict
Utilities¶
-
realvalidation.utils.
enumerate_phone_column_index_from_row
(row)[source]¶ Enumerates the phone column from a given row. Uses Regexs
Parameters: row (list) – list of cell values from row Returns: phone column index enumerated from row Return type: int
-
realvalidation.utils.
get_cell_values_from_row
(row)[source]¶ Returns string representation of cell values from row in a list
Parameters: row (list) – list of values Returns: string representation of cell values from row in a list Return type: list
-
realvalidation.utils.
is_dnc_json_response_on_dnc
(response)[source]¶ Determines if json response from DNC API is on dnc
Parameters: response (dict) – dictionary response from RealValidation DNC API Returns: True/False value whether response is on DNC or not Return type: bool
-
realvalidation.utils.
is_value_phone_identifier
(value)[source]¶ Returns True/False whether value is [Pp]hone or 10 numerical digits only
Parameters: value (str) – Value to determine if phone identifier Returns: True/False value whether phone is a valid identifier Return type: bool
Errors¶
-
exception
realvalidation.errors.
InvalidJSONResponseError
[source]¶ Raised when we couldn’t decode a JSON response from a RealValidation API Request
-
exception
realvalidation.errors.
InvalidPhoneFormatError
[source]¶ Raised when a phone string doesn’t match
PHONE_REGEX
-
exception
realvalidation.errors.
InvalidTokenError
[source]¶ Raised when a token couldn’t be enumerated. Tokens can passed as a parameter when initializing a
RealValidation
object or by setting theRV_TOKEN
environmental variable before execution.