From 2224236c8d7ffffaa63fc22f3cbc411a4fc6fa5a Mon Sep 17 00:00:00 2001 From: Howprobable Date: Wed, 11 Jun 2025 17:57:48 +0200 Subject: [PATCH] Add caching option to list_tab method --- pychrome/browser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pychrome/browser.py b/pychrome/browser.py index f47d8c6..0489c09 100644 --- a/pychrome/browser.py +++ b/pychrome/browser.py @@ -29,7 +29,10 @@ def new_tab(self, url=None, timeout=None): self._tabs[tab.id] = tab return tab - def list_tab(self, timeout=None): + def list_tab(self, timeout=None, use_cache=False): + if use_cache: + return list(self._tabs.values()) + rp = requests.get("%s/json" % self.dev_url, json=True, timeout=timeout) tabs_map = {} for tab_json in rp.json():