knuverse package¶
Knufactor¶
Copyright 2014, Intellisis All rights reserved.
-
class
knuverse.knufactor.
Knufactor
(apikey=None, secret=None, email=None, password=None, server='https://cloud.knuverse.com', base_uri='/api/v1/')¶ -
about
()¶ Get server info. Uses GET to /about interface
Returns: dict - Server information
-
auth_grant
(*args, **kwargs)¶ Used to get a grant token. Grant tokens expire after 5 minutes for role “grant_verify” and 10 minutes for the “grant_enroll” and “grant_enroll_verify” roles. Grant tokens can be used to start enrollments and verifications. Uses POST to /auth/grant interface
Args: - client: (str) Client name
Kwargs: - role: (str or None) The grant token role. Can be “grant_verify”, “grant_enroll”, or “grant_enroll_verify”. If role is not sent in, the role defaults to “grant_verify”.
- mode: (str or None) The mode to perform actions with. Can be “audiopass” or “audiopin”. It defaults to the module setting’s “mode_default” if None is passed in.
Returns: (dictionary) Specified below
Return Dictionary: - jwt - (str) Grant token that can be used to do verifications
- mode - (str) Default enrollment and verification mode for the server. Either “audiopin” or “audiopass”
-
auth_refresh
(apikey=None, secret=None, email=None, password=None)¶ Renew authentication token manually. Uses POST to /auth interface
Parameters: - apikey (str or None) – Unique identifier for authorized use of the API
- secret (str or None) – The secret password corresponding to the API key.
- email – Email to use for authentication
- apikey – Password corresponding to email
Returns: None
-
auth_token
(apikey=None, secret=None, email=None, password=None)¶ Get authentication token. Uses POST to /auth interface.
Returns: (str) Authentication JWT
-
client_count
(*args, **kwargs)¶ Get number of clients. Uses HEAD to /clients interface.
Returns: (int) Number of clients
-
client_create
(*args, **kwargs)¶ Create a new client. Uses the POST to /clients interface.
Args: - name: (str) Name of client
- password: (str) Password of client
Returns: (str) ID of the newly created client.
-
client_id
(*args, **kwargs)¶ Get a client’s ID. Uses GET to /clients?name=<client> interface.
Args: - client: (str) Client’s name
Returns: (str) Client id
-
client_info
(*args, **kwargs)¶ Get client info. Uses GET to /clients/<client> interface.
Args: - client: (str) Client’s ID
Returns: (dict) Client dictionary
-
client_list
(*args, **kwargs)¶ Get list of clients. Uses GET to /clients interface.
Kwargs: - name: (str) If specified, returns the client information for this client only.
- name_only: (bool) If true, returns only the names of the clients requested
- all_enrolled: (bool) If true, will return all enrolled clients
Returns: (list) List of dictionaries with the client information as requested.
-
client_unenroll
(*args, **kwargs)¶ Unenroll a client. Uses DELETE to /clients/<client> interface.
Args: - client: (str) Client’s ID
-
client_update
(*args, **kwargs)¶ Update client info Uses PUT to /clients/<client> interface
Args: - client: (str) Client’s ID
Kwargs: - reason: (str) The reason for changing the client’s settings
- pin: (str) The new PIN to set
- current_pin: (str) The current PIN of the user. Only required if role is not admin and the Account Reset Mode (System Configuration) requires PIN.
- verification_speed: (int) The speed at which the verification should appear for the client. Allowed values: 0, 25, 50, 75, 100.
- row_doubling: (str) Row doubling is an AudioPIN only option that puts two rows of words in each pinpad digit. Allowed values: “OFF”, “TRAIN”, “ON”
- password: (str) New client password
- bypass_expiration: (int) Used to enable/disable a client’s bypass. The time, in minutes, from when the request was received until the bypass expires. 0 removes the bypass, while -1 sets a bypass that doesn’t expire.
- bypass_limit: (int) The number of times a user may bypass. Set to 0 for no limit. If set without either an existing valid bypass_expiration, or providing one in the request, the client’s bypass_expiration will be set to 10 mins. Default value: 0. Size range: >=0
- bypass_spacing_minutes: (int) Specifies the time, in minutes, the user must wait between using each bypass. Set to 0 for no bypass rate limiting. If set without either an existing valid bypass_expiration, or providing one in the request, the client’s bypass_expiration will be set to 10 mins.
- bypass_code: (str) The code that the client must enter to bypass.
- is_disabled: (bool) If true, the client cannot do verifications (will automatically bypass).
- verification_lock: (bool) Unlocks the given client if the client verified incorrectly too many times.
- password_lock: (bool) Set to false to unlock a client who enter thier password incorrectly too many times.
- enroll_deadline_extension_minutes: (int) Amount of time, in minutes, to extend an enrollment deadline by.
- enroll_deadline_enable: (bool) When true, enables the enrollment deadline for a certain client, when false disables an enrollment deadline.
- windows_profile: (str) Assigns a Windows Profile to the user using the Windows Profile ID. To remove a profile, send null.
- role_rationale: (str) Update the client rationale for a role
- role: (str) Update the client role. Note: Google users cannot have their role updated. Allowed values: “admin”, “manager”, “support”, “user”.
More information: Can be found here.
-
client_validate_password
(*args, **kwargs)¶ Validate client’s password. Uses PUT to /clients/<client> interface.
Args: - client: (str) Client’s ID
- password: (str) Client’s Password
-
client_validate_pin
(*args, **kwargs)¶ Validate client’s PIN. Uses PUT to /clients/<client> interface.
Args: - client: (str) Client’s ID
- pin: (str) Client’s PIN
-
enrollment_resource
(*args, **kwargs)¶ Get Client Enrollment Data. Uses GET to /enrollments/<client> interface.
Args: - client: (str) Client’s ID
- audio: (boolean) If True then the enrollment audio is returned.
Returns: (dictionary) Look here for information on keys and values.
-
enrollment_start
(*args, **kwargs)¶ Start Client Enrollment. Uses the POST to /enrollments interface.
Args: - client: (str) Client’s Name
- mode: (str) DEPRECATED. Presence of PIN is used to determine mode (AudioPass vs AudioPIN)
- pin: (str) Client’s PIN. 4 digit string
- phone_number: (str) Phone number to call.
Returns: (dict) Enrollment record with prompts as described here.
-
enrollment_upload
(*args, **kwargs)¶ Upload Enrollment Data. Uses PUT to /enrollments/<enrollment_id> interface.
Args: - enrollment_id: (str) Enrollment’s ID
- audio_file: (str) Path to the audio file of the recorded words. Not required for phone enrollments.
-
events_client
(*args, **kwargs)¶ Get a client’s events. Uses GET to /events/clients/<client> interface.
Args: - client: (str) Client’s ID
Returns: (list) Events
-
events_clients
(*args, **kwargs)¶ Get all client events. Uses GET to /events/clients interface.
Returns: (list) Events
-
events_login
(*args, **kwargs)¶ Get all login events. Uses GET to /events/login interface.
Returns: (list) Events
-
events_system
(*args, **kwargs)¶ Get all system events. Uses GET to /events/system interface.
Returns: (list) Events
-
module_settings
(*args, **kwargs)¶ Get Module settings. Uses GET to /settings/modules interface.
Returns: (dict) Module settings as shown here.
-
report_events
(*args, **kwargs)¶ Create a report for all client events or all system events. Uses GET to /reports/events/{clients,system} interface
Args: - start_date: (datetime) Start time for report generation
- end_date: (datetime) End time for report generation
Kwargs: - type: (str) Type of event report to create. “system” or “clients”
Returns: (list) List of events in the input range
-
report_verifications
(*args, **kwargs)¶ Create a report for all verifications. Uses GET to /reports/verifications interface
Args: - start_date: (datetime) Start time for report generation
- end_date: (datetime) End time for report generation
Returns: (str) CSV formatted report string
-
settings_module_reset
(*args, **kwargs)¶ Resets the module settings back to default. Uses DELETE to /settings/modules interface.
-
settings_module_update
(*args, **kwargs)¶ Set Module settings. Uses PUT to /settings/modules interface.
Args: - mode_audiopin_enable: (bool) Turn on and off the AudioPIN feature
- mode_audiopass_enable: (bool) Turn on and off the AudioPass feature
- mode_default: (str) Set the default verification mode. Either ‘audiopin’ or ‘audiopass’.
Returns: None
-
settings_system
(*args, **kwargs)¶ Get system settings. Uses GET to /settings/system interface.
Returns: (dict) System settings as shown here.
-
settings_system_reset
(*args, **kwargs)¶ Resets the system settings back to default. Uses DELETE to /settings/system interface.
-
settings_system_update
(*args, **kwargs)¶ Set system settings. Uses PUT to /settings/system interface
Args: - data: (dict) Settings dictionary as specified here.
Returns: None
-
status
(*args, **kwargs)¶ Get server status. Uses GET to /status interface.
Returns: (dict) Server status as described here.
-
verification_cancel
(*args, **kwargs)¶ Cancels a started verification. Uses PUT to /verifications/<verification_id> interface
Args: - verification_id: (str) Verification ID
Kwargs: - reason: (str) Reason for cancelling the verification
Returns: None
-
verification_count
(*args, **kwargs)¶ Get Verification Count. Uses HEAD to /verifications interface.
Returns: (int) Number of verifications
-
verification_delete
(*args, **kwargs)¶ Remove verification. Uses DELETE to /verifications/<verification_id> interface.
Args: - verification_id: (str) Verification ID
-
verification_list
(*args, **kwargs)¶ Get list of verifications. Uses GET to /verifications interface.
Returns: (list) Verification list as specified here.
-
verification_resource
(*args, **kwargs)¶ Get Verification Resource. Uses GET to /verifications/<verification_id> interface.
Args: - verification_id: (str) Verification ID
- audio: (boolean) If True, audio data associated with verification will be returned.
Returns: (dict) Verification data as shown here.
-
verification_resource_secure
(*args, **kwargs)¶ Get Verification Resource. Uses GET to /verifications/<verification_id> interface Use this method rather than verification_resource when adding a second factor to your application. See this for more information.
Args: - verification_id: (str) Verification ID
- jwt: (str) Completion token received from application
- name: (str) Client name associated with the jwt. Received from application.
Returns: (dict) Verification data as shown here.
-
verification_start
(*args, **kwargs)¶ Start a verification. Uses POST to /verifications interface.
Args: - client: (str) Client’s Name
- mode: (str) Verification Mode. Allowed values: “audiopin”, “audiopass”
- verification_speed: (int) Allowed values: 0, 25, 50, 75, 100
- row_doubling: (str) Allowed values: “off”, “train”, “on”
- phone_number: (str) Phone number to call.
Returns: (dict) Verification record with animation as discussed here.
-
verification_upload
(*args, **kwargs)¶ Upload verification data. Uses PUT to /verfications/<verification_id> interface
Args: - verification_id: (str) Verification ID
- audio_file: (str) Path to the audio file of the recorded words. Not required for phone verifications.
- bypass: (boolean) True if using a bypass code or pin to verify
- bypass_pin: (str) Client’s PIN if this is a bypass
- bypass_code: (str) Client’s bypass code if this is a bypass
-
Exceptions¶
-
exception
knuverse.exceptions.
BadRequestException
¶ Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Bad Request(400) Errors
-
exception
knuverse.exceptions.
ForbiddenException
¶ Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Forbidden(403) Errors
-
exception
knuverse.exceptions.
HttpErrorException
¶ Bases:
exceptions.Exception
Used for HTTP errors. Status codes >= 400
-
exception
knuverse.exceptions.
InternalServerErrorException
¶ Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Internal Server Error(500) Errors
-
exception
knuverse.exceptions.
NotFoundException
¶ Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Not Found(404) Errors
-
exception
knuverse.exceptions.
RateLimitedException
¶ Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Rate Limited(429) Errors
-
exception
knuverse.exceptions.
RequestException
¶ Bases:
exceptions.Exception
Used for invalid requests.
Bases:
knuverse.exceptions.HttpErrorException
Used for HTTP Unauthorized(401) Errors
-
exception
knuverse.exceptions.
UnexpectedResponseCodeException
¶ Bases:
exceptions.Exception
Raised when the server returns an unexpected response code.