sigaa.mailbox.Mailbox Documentation

class sigaa.mailbox.MailBox(session, domain)

Class to viabilizate some operations on Mail Box of the SIGAA Portal. Created to be used mainly by the sigaa.api.API, use only if you know what you are doing.

Parameters:
  • session (requests.Session) – An autheticated requests.Session from sigaa.api.API.
  • domain (String) – The domain of the SIGAA platform of the university server. Example: ‘sigaa.ufpi.br’
add_user_recipient(user, subject='', message='')

Add user as recipient of the message

Parameters:
  • user (String) – User to be added as recipient of the message. Example: “BRUNO DO NASCIMENTO MACIEL (macielti)”
  • subject (String) – Subject of the message (optional).
  • message (String) – Message text (optional).
Returns:

True for success or False for failure.

Return type:

Boolean

goto_mainbox_portal()

Request the Mailbox portal.

Returns:True for success or False for failure.
Return type:Boolean
>>> from sigaa.api import API
>>> from sigaa.mailbox import MailBox
>>> api = API()
>>> api.authenticate('macielti', '9pfP52ZpB5eE')
>>> mail_box = MailBox(api.get_session(), api.get_domain())
>>> mail_box.goto_mainbox_portal()
goto_send_message()

This method acess the page used to send messages.

Returns:True for success or False for failure.
Return type:Boolean
>>> from sigaa.api import API
>>> from sigaa.mailbox import MailBox
>>> api = API()
>>> api.authenticate('macielti', '9pfP52ZpB5eE')
>>> mail_box = MailBox(api.get_session(), api.get_domain())
>>> mail_box.goto_mainbox_portal()
>>> mail_box.goto_send_message()
True
search(query, subject='', message='')

Search the users using the AJAX requisition.

Parameters:
  • query (String) – Search users by partial or full match on username. Example: “macielti”
  • subject (String) – Subject of the message (optional).
  • message (String) – Message text (optional).
Returns:

List of users info provided by the platform.

Return type:

list

>>> from sigaa.api import API
>>> from sigaa.mailbox import MailBox
>>> api = API()
>>> api.authenticate('macielti', '9pfP52ZpB5eE')
>>> mail_box = MailBox(api.get_session(), api.get_domain())
>>> mail_box.goto_mainbox_portal()
>>> mail_box.goto_send_message()
>>> mail_box.search('macielti')
['BRUNO DO NASCIMENTO MACIEL (macielti)']
send_message(subject, message)

Send message to previusly added users.

Created to be used mainly by the sigaa.api.API, use only if you know what you are doing.

Parameters:
  • subject (String) – Subject of the message.
  • message (String) – Message text.
Returns:

True for success or False for failure.

Return type:

Boolean

simulate_user_selection(user, subject='', message='')

Simulate the select operation. It’s required when adding an user as recipient of a message. Created to be used inside the MailBox.add_user_recipient() method.

Parameters:
  • user (String) – User to simulate seletion. Example: “BRUNO DO NASCIMENTO MACIEL (macielti)”
  • subject (String) – Subject of the message (optional).
  • message (String) – Message text (optional).
Returns:

True for success or False for failure.

Return type:

Boolean