apicrud.messaging.confirmation

confirmation.py

Confirmation

Handle the request and confirm actions for a contact.

created 4-apr-2020 by richb@instantlinux.net

Classes

Confirmation(models)

Functions for confirming ownership of online email/contact info

class apicrud.messaging.confirmation.Confirmation(models)

Functions for confirming ownership of online email/contact info

models

the models file object

Type

obj

confirm(token)

Confirm a contact if token is still valid

Parameters

token (str) – the token generated previously

Returns

first item is dict with fields as defined in SessionManager.create, second item is the http response code

Return type

tuple

request(id, ttl=None, message='contact_add', func_send=None)

Generate a confirmation token valid for a given period, and send it to the contact identified by id

Parameters
  • id (str) – record ID in contacts table of database

  • ttl (int) – how many seconds before token expires

  • message (str) – key in i18n dict for contact-add message

  • func_send (function) – name of function for sending message

Returns

first item is dict with token and contact-ID, second is the http response code

Return type

tuple