Search code examples
pythonshareplum

Python Shareplum getListItems query


Looking for direction with Python & Shareplum.

I am trying to run the following query (very much from the shareplum document),


fields = ['ID', 'Title', 'RaceDate', 'RaceNumber']
    query = {'Where': ['And', 
                        ('Eq', 'Title', location),
                        ('Eq', 'RaceDate', current_date),
                        ('Eq', 'RaceNumber', raceNumber)]}
    sp_raceChecklist_query = sp_raceChecklist.GetListItems(fields=fields, query=query)

however i get the following error: shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : 500 Server Error: Internal Server Error for url: https://tsite.com/sites/list//_vti_bin/lists.asmx

The thing is that if my query has only to arguments, it works. So for example, this works:

fields = ['ID', 'Title', 'RaceDate', 'RaceNumber']
    query = {'Where': ['And', 
                        ('Eq', 'Title', location),
                        ('Eq', 'RaceNumber', raceNumber)]}
    sp_raceChecklist_query = sp_raceChecklist.GetListItems(fields=fields, query=query)

Is my where query incorrect when trying to qualify against three columns? Or is it not supported?

Thank you in advance.


Solution

  • I figured it out

    query = {'Where': ['And', ('Eq', 'Title', location),
                            'And',  ('Eq', 'RaceDate', current_date),
                                    ('Eq', 'RaceNumber', raceNumber)]}
    

    Just didn't look hard enough :-(