Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for a ListingId that includes a "-" (dash character) using search(search_filter={}) #223

Open
theodorebear opened this issue Feb 1, 2021 · 2 comments

Comments

@theodorebear
Copy link

Hi all! Love this library and only ran into one snag so far.

While searching a Listing resource, Listing class, supplying a dict to search_filter, and the field I want to match on is "V0-215012678", which is in CRMLS (Southern California).

When running with a dict {'ListingId': 'V0-215012678'}, I get the following:

Traceback (most recent call last): File "/Users/theodorebear/Documents/closehack-mls/lib/mls.py", line 1672, in request for i,result in enumerate(results): File "/Users/theodorebear/.pyenv/versions/3.6.11/lib/python3.6/site-packages/rets/session.py", line 417, in search for res in search_cursor.generator(response=response): File "/Users/theodorebear/.pyenv/versions/3.6.11/lib/python3.6/site-packages/rets/parsers/search.py", line 52, in generator raise RETSException(msg) **rets.exceptions.RETSException: RETS Error 20206: Could not parse DMQL2 Query: Invalid character: ' at or near position 11. [...ListingId= !-->'V0-2150126]**

Converting to dmql_query='(ListingId="V0-215012678")' seemed to do the trick for me since it was a DMQL query with the item wrapped in quotes.

If this package was able to convert the single quotes in the {'ListingId': 'V0-215012678'} to double quotes, then I could stick with the search_filter={} dict method of searching, but for now I think I'll have to bypass that completely and convert all queries to DMQL.

@mcrowson
Copy link
Member

mcrowson commented Feb 1, 2021

Can take a look at a long term solution, but what about using double quotes in your filters?

@theodorebear
Copy link
Author

aha! why didn't I think of that... it worked.

q['values'] = [f'"{v}"' for v in q['values']] 
queryDict['ListingId'] = {"$in": q['values']}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants