[英]Authentication for downloading excel file from direct sharepoint link (python)
[英]Downloading an excel file from a link in python
我在页面上有一个名为“单击此处下载”的链接,其HTML格式为
<span id="spnDwnRec">
<a class="spnRecordText" onclick="CallExcelFunction()" href="#"> Click here to download all records.</a>
</span>
当我单击“单击此处下载”时,将下载一个excel文件,实际上我需要找到链接以下载excel文件。
我有下面的代码的JavaScript功能
function CallExcelFunction() {
var hidInd = document.getElementById('hidInd');
var hidFromDate = document.getElementById('hidFromDate');
var hidToDate = document.getElementById('hidToDate');
var hidDMY = document.getElementById('hidDMY');
window.open('indices_main_excel.aspx?ind=' + hidInd.value + '&fromDate=' + hidFromDate.value + '&toDate=' + hidToDate.value + '&DMY=' + hidDMY.value, '_blank',
'toolbar=yes,location=no, directories=no, status=no, menubar=yes,scrollbars=yes, resizable=yes ,copyhistory=no, width=800, height=600');
}
任何人都可以清除此数据,在此先感谢
当您单击该按钮时,将调用javascript函数,并且该函数可能会重定向到文件。
为了能够使用python下载文件,您要么需要自己找到链接(如果您始终下载同一文件),然后使用urllib。 为此,您可以阅读javascript代码。
或者您需要使用一些浏览器自动化工具(例如,通过python),例如selenium: http : //seleniumhq.org/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.