zulip / python-zulip-api

Python library for the Zulip API.
https://zulip.com/api/
Apache License 2.0
355 stars 358 forks source link

Add a context manager to manage storage #679

Closed PIG208 closed 3 years ago

PIG208 commented 3 years ago

In the documentation, we have:

Since each access to bot_handler.storage will involve a round-trip to the server, we recommend writing bots so that they do a single bot_handler.storage.get at the start of handle_message, and a single bot_handler.storage.put at the end to submit the state to the server. We plan to offer a context manager that takes care of this automatically.

The goal is to implement a context manager for bot_handler.storage.put and bot_handler.storage.get.

PIG208 commented 3 years ago

@zulipbot claim