I have already written a script that will take an .xlsm file and will update this file based on some other file and then will plot a graph according to the updated data. The Script is working fine. But now as this script is contributing to automation of a process,it needs to get the Excel(.xlsm) file from a url and then update the file and may be save it back to the same url.
I have tried downloading the file into a local copy using below code-
import requests
url = 'https://sharepoint.amr.ith.intel.com/sites/SKX/patchboard/Shared%20Documents/Forms/AllItems.aspx?RootFolder=%2Fsites%2FSKX%2Fpatchboard%2FShared%20Documents%2FReleaseInfo&FolderCTID=0x0120004C1C8CCA66D8D94FB4D7A0D2F56A8DB7&View={859827EF-6A11-4AD6-BD42-23F385D43AD6}/Copy of Patch_Release_Utilization'
r = requests.get(url)
open('Excel.xlsm', 'wb').write(r.content)
By doing this I am getting the error-
Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),)
What I understood till now is that the Server is not sending the complete Chain Certificates to the browser for authentication.
I also tried-
r=requests.get(url,verify=False)
By doing this error is gone but The file created is empty.When I checked status code for the connection using code-
r=requests.get(url,verify=False).status_code
I got the code as "401" which means authorization error.I have tried providing authentication as-
resp = requests.get(url,auth=HTTPBasicAuth('username', 'password'),verify=False)
and
resp = requests.get(url,auth=HTTPBasicAuth('username', 'password'))
both the above lines I have tried but still status code remained same. Then I came along an article-Python requests SSL error - certificate verify failed ,where the author is asking to add missing certificates in a .pem file then use that pem file.How to know what are the missing certificates??So din't get any help from there also.
Can somebody please help me with this if somebody already catered this problem.It will be a great help.I am using Python3.6.3 and requests version is 2.18.4
NOTE- When i am using the link manually on Internet Explorer I am able to download the file