sharepy
sharepy copied to clipboard
Too many redirects error
I get this error when running this code:
File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 166, in resolve_redirects raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp) requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
Can max_redirects be added to the code?
SharePy extends requests, so you should be able to set the max_redirects property on your SharePy session directly.
s = sharepy.connect("example.sharepoint.com")
s.max_redirects = 10
You can set it to whatever value you need, but if you're needing more than 30 you should probably check your code and the redirect location header to make sure it's working as you are expecting.