nylas/nylas-python

No example of filtering threads by "in" keyword

Closed this issue · 4 comments

"in" is a Pytthon global (e.g. if 5 in range(10): print 'hello') as well as a filter criteria for threads to filter by label or folder.

So when I try to retrieve all threads in the "Inbox" folder using this python client library, I encounter a SyntaxError, for example:

>> client.threads.where(in='Inbox').all()
  File "<ipython-input-110-8840a3c28956>", line 1
    client.threads.where(in='Inbox').all()
                          ^
SyntaxError: invalid syntax

How do I perform this filter? I can make a README pull request change if you guys let me know how to do it! :)

Hi there!

This should work: client.threads.where(in_='inbox').all().

k

Hi,
Sorry, still having hard time.
So, what I want to do is to pull out whole email body texts from a specific folder.
I checked the folder names by running client.folders.all()
I wanted to check all emails in 'Bounced' folder, so ran this code.

>> client.threads.where(in_='Bounced').all()

InvalidRequestError: {"url": "https://api.nylas.com/threads?in_=Bounced&limit=50&offset=0", "status_code": 400, "message": "Unexpected query parameters set(['in_'])", "data": null}

What does this error mean?
It seems as the api still does not recognize the query parameter 'in_'.

Sorry about that @khamidou ! Turns out I was using an older version of the client library (1.1.0 instead of most recent 1.2.2)

Great to see this resolved! Let me know if you've got comments about the Python docs too!