sharepy icon indicating copy to clipboard operation
sharepy copied to clipboard

Too many redirects error

Open smitwil04 opened this issue 4 years ago • 1 comments

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?

smitwil04 avatar Sep 15 '21 14:09 smitwil04

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.

JonathanHolvey avatar Sep 15 '21 21:09 JonathanHolvey