Before we can call our new function from Application, we need to implement a way to create a CSV extract of the daily data. This will be used by more than one function, so we'll implement it separately from the function that calls the upload code. Follow along with these steps:
- To begin, we'll need a temporary location to store our generated CSV file. The tempfile module includes functions to work with temporary files and directories; we'll import mkdtemp(), which will give us a name for a platform-specific temporary directory.:
from tempfile import mkdtemp