404 Client Error: Not Found for url: self._url("Lists")
See original GitHub issueI am trying to run the unit test suite (https://gitlab.com/dHannasch/shareplum/-/blob/gitlab-ci-yml/.gitlab-ci.yml).
On every test, when it goes to create a Site, I get an error.
Traceback (most recent call last):
File "/builds/dHannasch/shareplum/shareplum/request_helper.py", line 17, in post
response.raise_for_status()
File "/usr/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: [self._url("Lists")]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/builds/dHannasch/shareplum/tests/test_site.py", line 24, in setUp
self.site = Site(TEST_SETTINGS["site_url"], version=version, auth=auth)
File "/builds/dHannasch/shareplum/shareplum/site.py", line 549, in Site
return _Site365(site_url,
File "/builds/dHannasch/shareplum/shareplum/site.py", line 406, in __init__
super().__init__(site_url, auth, authcookie, verify_ssl, ssl_version, huge_tree, timeout)
File "/builds/dHannasch/shareplum/shareplum/site.py", line 98, in __init__
self.users = self.get_users()
File "/builds/dHannasch/shareplum/shareplum/site.py", line 341, in get_users
response = post(self._session,
File "/builds/dHannasch/shareplum/shareplum/request_helper.py", line 20, in post
raise ShareplumRequestError("Shareplum HTTP Post Failed", err)
shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : 404 Client Error: Not Found for url: [self._url("Lists")]
@isaacnorman82 Do you have any idea what could be happening? You seem knowledgeable about these requests.
What’s particularly striking here is that I cannot get a 404 outside of Shareplum, even by completely skipping authentication.
python -c "from requests import post; print(post('$SHAREPOINT_SERVER_URL/sites/$SHAREPOINT_SITE_NAME//_vti_bin/lists.asmx'))"
yields a login page as HTML; that is, it returns 200 OK. Maybe a 404 has some special meaning for a SOAP request? I don’t know.
For the record, I’m pretty sure I have the Sharepoint version correct (2016), but in any case I don’t…think that version should matter for this. Unless the 404 does have some special meaning.
Note that this is using https://github.com/jasonrollins/shareplum/pull/153 rather than the Office 365 authentication.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
I did some reading and it seems my memory is a little incorrect. I’ve only used SharePoint 2010 and 2013, not 2016. SharePlum uses NTLM for 2010 through 2016, but I don’t think 2016 supports NTLM. Here is an article I found that discussion the various authentication options. Since we are relying on requests here is the docs discussion authentication options. Maybe you can try some of the different options for requests. I’m pretty sure now that NTLM is NOT what you want. When I was using SharePoint 2010 and 2013, my username and password where the same for SharePoint and my computer. I think that is how NTLM works.
SharePlum automatically pulls the list of users when it connects to a SharePoint site. That’s where you are crashing. The 404 error is a standard permission failure. As you said, your script is getting a login screen. The SharePlum request is more involved. It’s actually trying to login and do things. Here is the post:
response = post(self._session, url=self._url("Lists"), headers=self._headers("GetListItems"), data=str(soap_request).encode("utf-8"), verify=self._verify_ssl, timeout=self.timeout)
It is connecting to the site and immediately pulling down the “UserInfo”.
What version of SharePoint are you using? The 404 could mean your username/password is incorrect. I think you have to include the domain in the username when you are using NTLM. If your user is dHannasch then the username=“DOMAIN/dHannasch”.