Bug:

Open
#136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Reproduce the failure with nonexistent channel IDs using the client.search call shown in the issue. Start at stream_chat/client.py, especially search and the response path in _parse_response, and determine where the empty-result behavior should be handled. Done means the same search returns an empty list instead of StreamAPIException.

Written by the indexing model from the issue text.

Description

When I use the client.search function for some channels ids which doesn't exist, instead of returning an empty list it gives me the following error:

Traceback (most recent call last):
  File "senti_abuse_analysis.py", line 177, in <module>
    response = client.search({"id": {"$in": channel_ids}}, {"updated_at":{"$gt": previous_max_date}}, limit=400)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p36/lib/python3.6/site-packages/stream_chat/client.py", line 358, in search
    return self.get("search", params={"payload": json.dumps(params)})
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p36/lib/python3.6/site-packages/stream_chat/client.py", line 90, in get
    return self._make_request(self.session.get, relative_url, params, None)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p36/lib/python3.6/site-packages/stream_chat/client.py", line 77, in _make_request
    return self._parse_response(response)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p36/lib/python3.6/site-packages/stream_chat/client.py", line 46, in _parse_response
    raise StreamAPIException(response.text, response.status_code)
stream_chat.base.exceptions.StreamAPIException: StreamChat error code 4: Search failed with error: "There are no searchable channels""
Dominant language
Python
Stars
73
Forks
20
Avg merge
11h 34m
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GetStream/stream-chat-python

All issues in GetStream/stream-chat-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.