gemini-webapi 1.14.1__py3-none-any.whl → 1.14.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gemini_webapi/client.py CHANGED
@@ -357,6 +357,7 @@ class GeminiClient:
357
357
  if not predefined_gems and not custom_gems:
358
358
  raise Exception
359
359
  except Exception:
360
+ await self.close()
360
361
  logger.debug(f"Invalid response: {response.text}")
361
362
  raise APIError(
362
363
  "Failed to fetch gems. Invalid response data received. Client will try to re-initialize on next request."
@@ -137,7 +137,7 @@ class GeneratedImage(Image):
137
137
  return v
138
138
 
139
139
  # @override
140
- async def save(self, **kwargs) -> str | None:
140
+ async def save(self, full_size=True, **kwargs) -> str | None:
141
141
  """
142
142
  Save the image to disk.
143
143
 
@@ -146,6 +146,8 @@ class GeneratedImage(Image):
146
146
  filename: `str`, optional
147
147
  Filename to save the image, generated images are always in .png format, but file extension will not be included in the URL.
148
148
  And since the URL ends with a long hash, by default will use timestamp + end of the hash as the filename.
149
+ full_size: `bool`, optional
150
+ If True, will modify the default preview (512*512) URL to get the full size image.
149
151
  kwargs: `dict`, optional
150
152
  Other arguments to pass to `Image.save`.
151
153
 
@@ -155,6 +157,9 @@ class GeneratedImage(Image):
155
157
  Absolute path of the saved image if successfully saved.
156
158
  """
157
159
 
160
+ if full_size:
161
+ self.url += "=s2048"
162
+
158
163
  return await super().save(
159
164
  filename=kwargs.pop("filename", None)
160
165
  or f"{datetime.now().strftime('%Y%m%d%H%M%S')}_{self.url[-10:]}.png",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gemini-webapi
3
- Version: 1.14.1
3
+ Version: 1.14.2
4
4
  Summary: ✨ An elegant async Python wrapper for Google Gemini web app
5
5
  Author: UZQueen
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -1,11 +1,11 @@
1
1
  gemini_webapi/__init__.py,sha256=7ELCiUoI10ea3daeJxnv0UwqLVKpM7rxsgOZsPMstO8,150
2
- gemini_webapi/client.py,sha256=9t_ytH4ClkjJWUwvLJ6KyArSRbNeGxd2MJVyPUmBIUA,30333
2
+ gemini_webapi/client.py,sha256=azxKBqpLJ1Vdlq-I6GYO5743TNeZRgi6sgI2XuxIk2A,30368
3
3
  gemini_webapi/constants.py,sha256=rkugkck9qXW_f-9dc0XXEjVIzJ9Ja4gHBVYDP71BESg,2352
4
4
  gemini_webapi/exceptions.py,sha256=qkXrIpr0L7LtGbq3VcTO8D1xZ50pJtt0dDRp5I3uDSg,1038
5
5
  gemini_webapi/types/__init__.py,sha256=Xap_FGOKOOC9mU3bmp_VT_1pQgFMuqbys_fOcyvTnuE,166
6
6
  gemini_webapi/types/candidate.py,sha256=67BhY75toE5mVuB21cmHcTFtw332V_KmCjr3-9VTbJo,1477
7
7
  gemini_webapi/types/gem.py,sha256=3Ppjq9V22Zp4Lb9a9ZnDviDKQpfSQf8UZxqOEjeEWd4,4070
8
- gemini_webapi/types/image.py,sha256=MflOex2tAxBF5zQkYTGTR78CuiqH3Wa6KxMKKXr5Yvo,5233
8
+ gemini_webapi/types/image.py,sha256=xCPaMzstIM5C09ZkJ0545vVPAsrF3y89XnRJrEWGz5k,5436
9
9
  gemini_webapi/types/modeloutput.py,sha256=h07kQOkL5r-oPLvZ59uVtO1eP4FGy5ZpzuYQzAeQdr8,1196
10
10
  gemini_webapi/utils/__init__.py,sha256=cJ9HQYxr8l0CsY61TFlho-5DdPxCaEOpRfjxPX-eils,320
11
11
  gemini_webapi/utils/get_access_token.py,sha256=eNn1omFO41wWXco1eM-KXR2CEi0Tb-chlph7H-PCNjg,6137
@@ -13,8 +13,8 @@ gemini_webapi/utils/load_browser_cookies.py,sha256=A5n_VsB7Rm8ck5lpy856UNJEhv30l
13
13
  gemini_webapi/utils/logger.py,sha256=0VcxhVLhHBRDQutNCpapP1y_MhPoQ2ud1uIFLqxC3Z8,958
14
14
  gemini_webapi/utils/rotate_1psidts.py,sha256=NyQ9OYPLBOcvpc8bodvEYDIVFrsYN0kdfc831lPEctM,1680
15
15
  gemini_webapi/utils/upload_file.py,sha256=SJOMr6kryK_ClrKmqI96fqZBNFOMPsyAvFINAGAU3rk,1468
16
- gemini_webapi-1.14.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
17
- gemini_webapi-1.14.1.dist-info/METADATA,sha256=Qlym2uwFz03bgKIed0UtBmLMGXfpJwJ8j-2qMraLgJw,58925
18
- gemini_webapi-1.14.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- gemini_webapi-1.14.1.dist-info/top_level.txt,sha256=dtWtug_ZrmnUqCYuu8NmGzTgWglHeNzhHU_hXmqZGWE,14
20
- gemini_webapi-1.14.1.dist-info/RECORD,,
16
+ gemini_webapi-1.14.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
17
+ gemini_webapi-1.14.2.dist-info/METADATA,sha256=O24rz39UbSBc0ZBGcDOOPHKD5BrP-4P-RSqWUP1jwMk,58925
18
+ gemini_webapi-1.14.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ gemini_webapi-1.14.2.dist-info/top_level.txt,sha256=dtWtug_ZrmnUqCYuu8NmGzTgWglHeNzhHU_hXmqZGWE,14
20
+ gemini_webapi-1.14.2.dist-info/RECORD,,