Blanco

Note

The documentation in this section is aimed at people wishing to contribute to blanco, and can be skipped if you are simply using the tool from the command line.

blanco.parse_msmtp(log, all_recipients=False, addresses=None, gmail=False)[source]

Parse sent messages mailbox for contact details.

Parameters:
  • log (str) – Location of the msmtp logfile
  • all_recipients (bool) – Whether to include all recipients in results, or just the first
  • addresses (list) – Addresses to look for in sent mail, all if not specified
  • gmail (bool) – Log is for a gmail account
Return type:

dict of str keys and arrow.Arrow values

Returns:

Keys of email address, and values of seen date

blanco.parse_sent(path, all_recipients=False, addresses=None)[source]

Parse sent messages mailbox for contact details.

Parameters:
  • path (str) – Location of the sent mailbox
  • all_recipients (bool) – Whether to include CC and BCC addresses in results, or just the first
  • addresses (list) – Addresses to look for in sent mail, all if not specified
Return type:

dict of str keys and arrow.Arrow values

Returns:

Keys of email address, and values of seen date

blanco.show_note(notify, message, contact, urgency=1, expires=-1)[source]

Display reminder.

Parameters:
  • notify (bool) – Whether to use notification popup
  • message (str) – Message string to show
  • contact (Contact) – Contact to show message for
  • urgency (int) – Urgency state for message
  • expires (int) – Time to show notification popup in milliseconds
Raises OSError:

Failure to show notification

class blanco.Contact(name, addresses, frequency)[source]

Initialise a new Contact object.

notify_str()[source]

Calculate trigger date for contact.

Return type:str
Returns:Stylised name for use with notifications
trigger(sent)[source]

Calculate trigger date for contact.

Parameters:sent (dict of str keys and arrow.Arrow values) – Address to last seen dictionary
Return type:arrow.Arrow
Returns:Date to start reminders on
class blanco.Contacts(contacts=None)[source]

Initialise a new Contacts object.

addresses()[source]

Fetch all addresses of all Contact objects.

Return type:list of str
Returns:Addresses of every Contact
parse(addressbook, field)[source]

Parse address book for usable entries.

Parameters:
  • addressbook (str) – Location of the address book to useful
  • field (str) – Address book field to use for contact frequency

Examples

>>> contact = Contact('James Rowe', 'jnrowe@gmail.com', 200)
>>> contact.trigger({'jnrowe@gmail.com': datetime.date(1942, 1, 1)})
<Arrow [1942-07-20T00:00:00+00:00]>