exporting csv file from website
<p>I currently have a python script that logs into a website and navigates to a table on a page defined by a url. This table has the functionality to be exported to a csv file. I am able to extract the html of the page as a csv file however not the contents of the table itself. </p>

<pre><code>def _getReport(self, pageID, outputFile):

    params = self.COMMAND_PARAMETERS.copy()
    params.update(PAGE_ID = pageID)

    r = self._session.post(self.URL, data = params)

    with open(outputFile, "wb") as f:
        f.write(r.content)
</code></pre>

<p>I am struggling to get the csv file by using the requests module and the command parameters are defined as:</p>

<pre><code>COMMAND_PARAMETERS = {
   "BI_COMMAND": "",
   "BI_COMMAND-BI_COMMAND_TYPE": "EXPORT",
   "BI_COMMAND-EXPORT_FORMAT": "CSV",
   "REQUEST_ID": "2"
}
</code></pre>

<p>and the page ID is automatically found by the script earlier on. Does anybody have any ideas as to why this is printing the html of the page and not the table itself,</p>

<p>Thanks,</p>

<p>Jane</p>