Giter Club home page Giter Club logo

Comments (4)

johnd0e avatar johnd0e commented on May 29, 2024

It seems that there are 2 packages missed in setup.py

  • loguru
  • pydantic

from gemini-api.

dsdanielpark avatar dsdanielpark commented on May 29, 2024

Thank you!

from gemini-api.

dsdanielpark avatar dsdanielpark commented on May 29, 2024

johnd0e, Fantasticj1

Please, try to use 1.0.4 or above!

We are currently modifying the package with a focus on extensive code refactoring and future maintainability, so errors may occur. We are also in the process of making adjustments to the returned dictionary for easier access in the future.

We appreciate your understanding. Thank you!!!

python uninstall python-gemini-api
python install python-gemini-api==1.0.4

from gemini-api.

johnd0e avatar johnd0e commented on May 29, 2024
  1. GeminiClient = Gemini(cookie_fp="cookies.json")
    For this case instructions recommends ExportThisCookies, but does not mentioned that downloaded with it cookies.txt is not real json: it is necessary to trim cookies = to make it valid json.
    But even with this I have no success:

    Error loading cookie file: 'Gemini' object has no attribute 'session'
    Traceback (most recent call last):
      File "D:\AI\Gemini-API\test2.py", line 11, in <module>
        GeminiClient = Gemini(cookie_fp="cookies.json") # Or use cookie file path
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\AI\Gemini-API\gemini\core.py", line 66, in __init__
        self.session = session or self._initialize_session()
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\AI\Gemini-API\gemini\core.py", line 94, in _initialize_session
        self._set_sid_and_nonce()
      File "D:\AI\Gemini-API\gemini\core.py", line 213, in _set_sid_and_nonce
        self._nonce = re.search(r'"SNlM0e":"(.*?)"', response.text).group(1)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'group'
    
  2. GeminiClient = Gemini(cookies=cookies) (where cookies are __Secure-1PSID, __Secure-1PSIDTS)
    I get an output, but it is not very helpful:

    {'metadata': ['c_409da1520e77ed5f', 'r_f3670ae69c52a4e1'], 'candidates': {'rcid': 'rc_594f1013ce897401', 'text': 'http://googleusercontent.com/card_content/0', 'web_images': [], 'generated_images': []}}
    
  3. GeminiClient = Gemini(auto_cookies=True) does not work:

    Traceback (most recent call last):
      File "D:\AI\Gemini-API\test.py", line 3, in <module>
        GeminiClient = Gemini(auto_cookies=True)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\AI\Gemini-API\gemini\core.py", line 66, in __init__
        self.session = session or self._initialize_session()
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\AI\Gemini-API\gemini\core.py", line 92, in _initialize_session
        self._set_cookies_automatically()
      File "D:\AI\Gemini-API\gemini\core.py", line 141, in _set_cookies_automatically
        if len(getattr(self, "cookies", {})) > 5:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: object of type 'NoneType' has no len()
    

from gemini-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.