module automation_students.projects_helper

Short summary

module ensae_teaching_cs.automation_students.projects_helper

A couple of functons which automates everything.

source on GitHub

Functions

function

truncated documentation

extract_students_mails_from_gmail_and_stores_in_folders

The scenario is the following:

Documentation

A couple of functons which automates everything.

source on GitHub

ensae_teaching_cs.automation_students.projects_helper.extract_students_mails_from_gmail_and_stores_in_folders(folder='.', filemails='emails.txt', user=None, pwd=None, server='imap.gmail.com', mailfolder=['ensae/ENSAE_2016_3A'], date='1-Jan-2016', zipfilename='projet_3A_2016.zip', zipencpwd=b'sixteenbyteskeys', dataframe=None, columns={'group': 'groupe', 'name': 'nom_prenom', 'subject': 'sujet'}, skip_names=None, process_name=None, title='List of emails', nolink_if=None, fLOG=<function fLOG>)[source]

The scenario is the following:

  • You are the teacher.

  • Students started their projects at date t.

  • They can work alone or by group.

  • They send mails, you reply.

  • Their address mail follows the convention: <first name>.<last name>@anything so it is to associate a mail address to a student name.

  • You move every mail you received in a separate folder in your inbox.

  • Sometime, you send a mail to everybody.

  • Finally they send their project with attachments.

  • You want to store everything (mails and attachements) in folders, one per group.

  • You want a summary of what was received.

  • You want to build a zip file to share their work with others teachers.

  • You want to update the folder if a new mail was sent.

This function looks into a folder of your inbox and grabs every mails and attachements from a groups of students.

Paramètres
  • folder – where to store the results

  • filemails – files used to store students address, the operation is done once, remove the file to force the function to rebuild the information.

  • user – user of the gmail inbox

  • pwd – password of the gmail inbox

  • server – gmail server, it should be "imap.gmail.com", it works with others mail servers using the IMAP protocol

  • mailfolder – folder in your inbox to look into, there can be several

  • date – when to start looking (do not change the format, look at the default value)

  • zipfilename – name of the zip file to create

  • zipencpwd – the zip file is also encrypted for a safer share with this key and function encrypt_stream.

  • dataframe – dataframe which contains the definition of students groups

  • columns – columns the function will look into, students names, group definition (a unique number for all students in the same group), subject

  • skip_names – list of names to skip

  • process_name – to operate a transformation before matching students names with their emails

  • title – each group folder contains a html file connecting them, this is its title

  • nolink_if – The summary extracts links from url, it skips the urls which contains on the substrings included in that list (None to use a default set)

  • fLOG – logging function

Renvoie

ProjectsRepository

By default, Gmail does not let you programmatically access you own inbox, you need to modify your gmail parameters to let this function do so.

source on GitHub