Code is as follows: I used the method of multiple excel file download, download files in the two methods are reported to the user name and password mistake, but the username and password are right, I can log in by hand,
Which master can help look at it?
Authentication Failure: AADSTS50126: Error validating credentials due to invalid username or password
#
Script Complete
Traceback (the most recent call last) :
The File "Report. Py", line 91, in & lt; module>
Urllib. Request. Urlretrieve (url, "temp. XLSX," fun)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 247, urlretrieve in
With contextlib. Closing (urlopen (url, data)) as fp:
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 222, in urlopen
Return opener. Open (url, data, the timeout)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 531, in the open
The response=meth (the req, response)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 641, in http_response
'HTTP' request, the response code, MSG, HDRS)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 569, the error in
Return the self. _call_chain (* args)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 503, in _call_chain
Result=func (* args)
The File "/local/anaconda3/lib/python3.7 urllib/request. Py", line 649, in http_error_default
Raise HTTPError (the req. Full_url, code, MSG, HDRS, fp)
urllib. Error. HTTPError: HTTP error 401: Unauthorized
The import pandas as pd
The import XLRD, XLWT
# the from xlutils. Copy the import copy
The import sharepy
The import of logging
The from sharepy import connect
The from sharepy import SharePointSession
The import urllib
Import a datetime
The import urllib. Request
The import of OS, time
The import HTTP. Cookiejar
The import requests
The import HTTP. Cookiejar as cookielib
SharepointSession=requests. The session ()
SharepointSession. Cookies=cookielib. LWPCookieJar (filename="sharepointCookies. TXT")
UserAgent="Mozilla/5.0 (X11; Linux x86_64; The rv: 38.0) Gecko/20100101 Firefox/38.0 "
The header={
"The Host" : "ericsson.sharepoint.com",
"The user-agent: Mozilla/5.0 (X11; Linux x86_64; The rv: 38.0) Gecko/20100101 Firefox/38.0 ",
"Accept", "text/HTML, application/XHTML + XML, application/XML. Q=0.9 */*;
q=0.8,"Accept - Language", "en - US, en;
q=0.5,"Accept - the Encoding", "gzip, deflate",
"Referer" : "https://ericsson.sharepoint.com/sites/RA-BB-XMU04/Shared%20Documents/Forms/AllItems.aspx",
"Cookies" : "MicrosoftApplicationsTelemetryDeviceId=fc74c60d - 3881-2966 - cb05 - c4bb9ce540ab; MicrosoftApplicationsTelemetryFirstLaunchTime=1594628753445; MicrosoftApplicationsTelemetryDeviceId=d018e2f2-0010 - f34d - 9 b5ae08c bb0-92692; MicrosoftApplicationsTelemetryFirstLaunchTime=1596517591842; ExcelWacDataCenter=EU2; WacDataCenter=EU2; Odbn=1; FedAuth=77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48U1A+VjgsMGguZnxtZW1iZXJzaGlwfDEwMDMzZmZmOGZmMDc5ZDVAbGl2ZS5jb20sMCMuZnxtZW1iZXJzaGlwfGtlZGkud2FuZ0Blcmljc3Nvbi5jb20sMTMyNDA5OTExNzkwMDAwMDAwLDEzMjQwNTQ1OTgwMDAwMDAwMCwxMzI0MTA4MzI4OTQ5NjUxMTAsMTkyLjE3Ni4xLjg1LDIsOTJlODRjZWItZmJmZC00N2FiLWJlNTItMDgwYzZiODc5NTNmLCwwYTFiMDdlZi00YzRkLTRlZDgtYjBhNS1jZjFlMzFkODkyNWEsOWRhMDZjOWYtNTA3YS1iMDAwLTgwOWEtZDEwODY1N2Y1NjU4LDBmYTY2YzlmLTIwMjAtYjAwMC03YTc0LTVlOWMyMTYxOTA1MiwsMCwxMzI0MTAwMDQ4OTQ4MDkxNDIsMTMyNDEyNTYwODk0ODA5MTQyLCwsLDI2NTA0Njc3NDM5OTk5OTk5OTksMTMyNDA5OTExODAwMDAwMDAwLDBlYWM0OTMzLTQ4ZDAtNDY4MC05ZTQ3LWJkYTU4NzE5ZTViZCxlb0NPYys0R0N3Rjg4Y2VtY255a1pGdGVLRFd3TG5qZkxFU3F1S1ViaW9HZXNISVJMckxBb090L2dDVkNIN0ZkTUhwbldtbGEvUnM5UDBiRGZkRFY5MEs5QjFsWHBNeU5FRXFjL29CTWhkenVpU0lzNEhYRCswdlZSNEVnVTFOcTRLcWZqNUk0TU5ZRFZCV1NVbEQ0Qjhiem9XMHNVWTdlSUMxWWZ2SDVUL2xJRDB0N1ZEQmYxc2krRSsxemkzZjZRcmtjWEtTWGYrQzFaaUUweE0ybkNkOVdTRXluNS9aTkludm82Yzl4OXRrODJSVjJVRGJMQS9mdVJNYUtKOFM1dmpKdXlkelZiVGR0U0dNZDUrQllQcVFjNmpRYU5QTTRSbWlWblJIZjJIdCtwZTAwUUdLekcrS2MrSzBncmRiUHhHbEhmbkY2YWN3dWxzejk5aE9JQUE9PTwvU1A+; rtFa=Zre4tPkpEM7HOy4rvrlHRSnmDVcO9hWDlMFJSRJIkcEmOTJFODRDRUItRkJGRC00N0FCLUJFNTItMDgwQzZCODc5NTNGIzEzMjQwOTkxMTgwODE5MDM0NSM5REEwNkM5Ri01MDdBLUIwMDAtODA5QS1EMTA4NjU3RjU2NTg7+C+jhD5bSbJI0spW7RkXDx4LhJFwW2u29OuDmlBxuOUjnCyvm9W+XOoapeP7l0ypvTPaJA/V5yCZfx5esEYRC6WD0WlHsbqetWZgsZJSVyCRzfHeqhWPxhyrUdR/VV2aiaH7xCxj8N49xPilZIMJ5D8Q4XDo89Ky5djyxRJCummqMmIbC6wFT2gJBo2ZX0+D2Or2h66I/TOoiy2Mhi/FZJ6UBcBxhR6xqaVx1n6/7LSeLNFJxoG1YABBwJngFtt4hkMWIJ5aAfU9AmA2ZQzZ+CujzbRMU2BhSbl1B9k+l8Wq/fV9ugbsWYTjxN16yNMFw25DtRyUcvTlX+PEeJIWfQAAAA==; Isso=dHJ1ZSwyODUwMCwyODgwMCwxNTk2NTUyMDYyODgyLDE1OTY1NTIzNjI4ODI=",
"Connection" : "keep alive -
"}
Params={" UniqueId ":" 75 be ac7 d36489-5-4446-81-679511181 e71 "}
The username=""
Password=""
Url="https://ericsson.sharepoint.com/sites/RA-BB-XMU04/_layouts/15/download.aspx? UniqueId=75 be ac7 d36489-5-4446-81-679511181 e71
"Def sharepointLogin (account, password) :
Print (" to start the simulation log in sharepoint ")
PostUrl="https://ericsson.sharepoint.com/_forms/default.aspx"
# postUrl="https://ericsson.sharepoint.com/login"
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull