shareplum icon indicating copy to clipboard operation
shareplum copied to clipboard

Can’t load list with space in title

Open wrathagom opened this issue 4 years ago • 1 comments

First of all, thanks for putting the effort in to simplify Sharepoint interactions. You're my hero. If you've got a patreon or similar I'd be interested in helping out.

I have a document library called "Corp Docs" that I can't load. When I do I get a 500 internal server error.


---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/shareplum/request_helper.py in post(session, url, **kwargs)
     16         response = session.post(url, **kwargs)
---> 17         response.raise_for_status()
     18         return response

/opt/conda/lib/python3.7/site-packages/requests/models.py in raise_for_status(self)
    940         if http_error_msg:
--> 941             raise HTTPError(http_error_msg, response=self)
    942 

HTTPError: 500 Server Error: Internal Server Error for url: https://my-site.sharepoint.com/sites/corpdocs/_api/lists/getbytitle('Corp%20Docs')/RenderListDataAsStream

During handling of the above exception, another exception occurred:

ShareplumRequestError                     Traceback (most recent call last)
<ipython-input-108-ccbfdca26fa6> in <module>
----> 1 list = site.List("Corp Docs")

/opt/conda/lib/python3.7/site-packages/shareplum/site.py in list(self, list_name, exclude_hidden_fields)
    499             self.timeout,
    500             exclude_hidden_fields=exclude_hidden_fields,
--> 501             site_url=self.site_url,
    502         )
    503 

/opt/conda/lib/python3.7/site-packages/shareplum/list.py in __init__(self, session, list_name, url, verify_ssl, users, huge_tree, timeout, exclude_hidden_fields, site_url)
    518         super().__init__(session, list_name, url, verify_ssl, users, huge_tree, timeout, exclude_hidden_fields, site_url)
    519         self.site_url = site_url
--> 520         self.schema = self._get_schema()
    521         self.version = "v365"
    522 

/opt/conda/lib/python3.7/site-packages/shareplum/list.py in _get_schema(self)
    530                    'X-RequestDigest': self.contextinfo['FormDigestValue']}
    531 
--> 532         response = post(self._session, url=url, headers=headers, data=body, timeout=self.timeout)
    533         return response.json()
    534 

/opt/conda/lib/python3.7/site-packages/shareplum/request_helper.py in post(session, url, **kwargs)
     18         return response
     19     except requests.exceptions.RequestException as err:
---> 20         raise ShareplumRequestError("Shareplum HTTP Post Failed", err)

ShareplumRequestError: Shareplum HTTP Post Failed : 500 Server Error: Internal Server Error for url: https://my-site.sharepoint.com/sites/corpdocs/_api/lists/getbytitle('Corp%20Docs')/RenderListDataAsStream

I'm assuming it has to do something with the space in the name, because I am successfully able to make the same call on a document library just called "Documents".

Let me know what else I can provide to try and troubleshoot this.

wrathagom avatar Nov 19 '20 16:11 wrathagom

Thanks for the kind words, sorry for the late replay. The space should not be an issue. Your last line shows that the library is treating the space correctly and changing it to 'Corp%20Docs'. I'm really not sure what the issue is.

jasonrollins avatar Jan 29 '21 00:01 jasonrollins