JonathanHolvey / sharepy

Simple SharePoint authentication for Python
GNU General Public License v3.0
175 stars 52 forks source link

Too many redirects error #56

Open smitwil04 opened 3 years ago

smitwil04 commented 3 years ago

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?

JonathanHolvey commented 3 years ago

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.