Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions zulip/zulip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,7 @@ def error_retry(error_string: str) -> bool:
if self.verbose:
if not query_state["had_error_retry"]:
sys.stdout.write(
"zulip API({}): connection error{} -- retrying.".format(
url.split(API_VERSTRING, 2)[0],
error_string,
)
f"zulip API({url.split(API_VERSTRING, 2)[0]}): connection error{error_string} -- retrying."
)
query_state["had_error_retry"] = True
else:
Expand Down Expand Up @@ -1641,6 +1638,28 @@ def get_storage(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any
request=request,
)

def remove_storage(self, request: Dict[str, Any]) -> Dict[str, Any]:
"""
Remove entries from the bot's storage.

Example:
>>> client.update_storage({'storage': {'a': '1', 'b': '2'}})
>>> client.remove_storage({'keys': ['a']})
>>> client.get_storage()
{'result': 'success', 'storage': {'b': '2'}, 'msg': ''}

Keyword args:
keys (List[str]): Keys to remove from storage.

Returns:
Dict[str, Any]: Standard Zulip API response dict.
"""
return self.call_endpoint(
url="bot_storage",
method="DELETE",
request=request or {},
)

def set_typing_status(self, request: Dict[str, Any]) -> Dict[str, Any]:
"""
Example usage:
Expand Down