Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit 31b8424

Browse files
committed
feat(client): add request count
1 parent 3a4b4b9 commit 31b8424

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gemini/client.py

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(
5959
"""
6060
Initializes the Gemini object with session, cookies, and other configurations.
6161
"""
62+
self._request_count = 0
6263
self._nonce = None # SNlM0e nonce value
6364
self._sid = None # session id
6465
self._rcid = None # response candidate id
@@ -75,6 +76,10 @@ def __init__(
7576
self.base_url: str = URLs.BASE_URL.value
7677
self.parser = ResponseParser(cookies=self.cookies)
7778

79+
@property
80+
def request_count(self) -> int:
81+
return self._request_count
82+
7883
@property
7984
def nonce(self) -> Optional[str]:
8085
return self._nonce
@@ -226,6 +231,7 @@ def send_request(
226231
self, prompt: str, image: Union[bytes, str] = None
227232
) -> Tuple[str, int]:
228233
"""Sends a request and returns the response text and status code."""
234+
self._request_count += 1
229235
params = self._construct_params(self._sid)
230236
data = self._construct_payload(prompt, image, self._nonce)
231237
response = self.session.post(

0 commit comments

Comments
 (0)