Connection using the SharePy library

Abi Winters 25 Reputation points
2025-08-27T08:19:00.51+00:00

Hi,

I have been using the SharePy python library to interact with my Sharepoint access for some time. As of last week, without any changes to either the Sharepoint, the account permissions, or my code, I suddenly started getting the following error when attempting to connect.

import sharepy
sharepy.connect("sitename", username="username", password="password")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/[username]/.local/lib/python3.11/site-packages/sharepy/session.py", line 15, in connect
    return SharePointSession(site, auth=autoauth)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/[username]/.local/lib/python3.11/site-packages/sharepy/session.py", line 61, in __init__
    self.auth.login(self.site)
  File "/home/[username]/.local/lib/python3.11/site-packages/sharepy/auth/spol.py", line 26, in login
    self._get_cookie()
  File "/home/[username]/.local/lib/python3.11/site-packages/sharepy/auth/spol.py", line 60, in _get_cookie
    cookie = self._buildcookie(response.cookies)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/[username]/.local/lib/python3.11/site-packages/sharepy/auth/spol.py", line 91, in _buildcookie
    return 'rtFa=' + cookies['rtFa'] + '; FedAuth=' + cookies['FedAuth']
                     ~~~~~~~^^^^^^^^
  File "/home/[username]/.local/lib/python3.11/site-packages/requests/cookies.py", line 334, in __getitem__
    return self._find_no_duplicates(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/[username]/.local/lib/python3.11/site-packages/requests/cookies.py", line 413, in _find_no_duplicates
    raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}")
KeyError: "name='rtFa', domain=None, path=None"


Has anyone encountered something similar?

Thanks.

Windows development | Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Danny Nguyen (WICLOUD CORPORATION) 1,120 Reputation points Microsoft External Staff
    2025-08-28T06:59:22.81+00:00

    Hi @Abi Winters ,

    This might be because Microsoft is starting to disable basic authentication: Basic authentication is being deprecated (SharePoint Server) - SharePoint Server | Microsoft Learn

    And I don't think you are the only one experiencing this, as the same issue was brought up in SharePy repository as well : Sharepy auth key error when accessing cookies dictionary · Issue #83 · JonathanHolvey/sharepy

    I suggest using other supported methods of authentication at this point. Consider reaching out to with tags like Microsoft 365 and Office | SharePoint | Development or Microsoft 365 and Office | SharePoint Server | For business for better help.

    Best Regards.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.