dsdanielpark / Gemini-API

The unofficial python package that returns response of Google Gemini through cookie values.
https://pypi.org/project/python-gemini-api/
MIT License
167 stars 14 forks source link

'Gemini' object has no attribute 'session' #32

Closed anujpaude1 closed 6 months ago

anujpaude1 commented 6 months ago

Code :


client = Gemini(cookie_fp="cookies.txt")

response = client.generate_content("Hello, Gemini. What's the weather like in Seoul today?")
response.payload

Error:

AttributeError                            Traceback (most recent call last)
[<ipython-input-6-25dd85f77876>](https://localhost:8080/#) in <cell line: 3>()
      1 from gemini import Gemini
      2 
----> 3 client = Gemini(cookie_fp="cookies.txt")
      4 
      5 response = client.generate_content("Hello, Gemini. What's the weather like in Seoul today?")

2 frames
[/usr/local/lib/python3.10/dist-packages/gemini/client.py](https://localhost:8080/#) in _set_cookies_from_file(self, file_path)
    141             raise Exception(f"Failed to load cookies from {file_path}: {e}")
    142 
--> 143         self.session.cookies.update(cookies)
    144 
    145     def _set_sid_and_nonce(self):

AttributeError: 'Gemini' object has no attribute 'session'
dsdanielpark commented 6 months ago

Thank you for reporting the issue.

The issue was resolved in the following commit: 13e797129855c6131e2b51991769540ad5f1c781

Please use version 2.4.12. If the problem persists, feel free to reopen the issue.