Skip to content

Commit

Permalink
fix: now cookie refresh task can be correctly canceled on init
Browse files Browse the repository at this point in the history
  • Loading branch information
HanaokaYuzu committed Mar 20, 2024
1 parent 9eecaac commit 800c82f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="assets/banner.png" width="55%" alt="Gemini Banner" align="center">
<img src="https://raw.githubusercontent.com/HanaokaYuzu/Gemini-API/master/assets/banner.png" width="55%" alt="Gemini Banner" align="center">
</p>
<p align="center">
<a href="https://pypi.org/project/gemini-webapi">
Expand All @@ -22,7 +22,7 @@
<img src="https://github.com/HanaokaYuzu/Gemini-API/actions/workflows/pypi-publish.yml/badge.svg" alt="CI"></a>
</p>

# <img src="assets/logo.svg" width="35px" alt="Gemini Icon" /> Gemini-API
# <img src="https://raw.githubusercontent.com/HanaokaYuzu/Gemini-API/master/assets/logo.svg" width="35px" alt="Gemini Icon" /> Gemini-API

A reverse-engineered asynchronous python wrapper for [Google Gemini](https://gemini.google.com) web app (formerly Bard).

Expand Down
4 changes: 2 additions & 2 deletions src/gemini_webapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ async def init(

self.auto_refresh = auto_refresh
self.refresh_interval = refresh_interval
if task := rotate_tasks.get(self.cookies["__Secure-1PSID"]):
task.cancel()
if self.auto_refresh:
if task := rotate_tasks.get(self.cookies["__Secure-1PSID"]):
task.cancel()
rotate_tasks[self.cookies["__Secure-1PSID"]] = asyncio.create_task(
self.start_auto_refresh()
)
Expand Down

0 comments on commit 800c82f

Please sign in to comment.