Comments (31)
same
from gemini-api.
Thanks for your reply. I tried all the codes you provided, and even when I add cookies manaully, the error still exsits. I think it may have nothing to do with automated cookie collection.
from gemini-api.
Realted this issue #14.
I have a cookie set that works on one laptop for nearly a month, but not on another, only returning empty responses. It might need more handling related to RotateCookie and exceptions, but I'm too busy with important schedules to spend much time on it.
Please share any solutions you find. I couldn't capture the nonce value with auto cookie but had no issues otherwise.
It might be necessary to reset all data through logins and logouts in different environments and properly define it using the ExportCookie extension.
Once I'm free, I plan to experiment with various accounts to find a solution.
from gemini-api.
thanks, but a new problem occured.
ValueError Traceback (most recent call last)
Cell In[6], [line 2](vscode-notebook-cell:?execution_count=6&line=2)
[1](vscode-notebook-cell:?execution_count=6&line=1) from gemini import Gemini
----> [2](vscode-notebook-cell:?execution_count=6&line=2) GeminiClient = Gemini(auto_cookies=True)
[3](vscode-notebook-cell:?execution_count=6&line=3) # GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSID", "__Secure-1PSIDTS"]) # Can select cookies.
[4](vscode-notebook-cell:?execution_count=6&line=4) response = GeminiClient.generate_content("Hello, Gemini. What's the weather like in Seoul today?")
File [c:\Users\user\anaconda3\envs\geminiapi\lib\site-packages\gemini\core.py:71](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:71), in Gemini.__init__(self, session, cookies, cookie_fp, auto_cookies, target_cookies, timeout, proxies)
[69](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:69) self.proxies = proxies or {}
[70](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:70) self.timeout = timeout
---> [71](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:71) self.session = session or self._initialize_session()
[72](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:72) self.base_url: str = URLs.BASE_URL.value
[73](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:73) self.parser = ResponseParser(cookies=self.cookies)
File [c:\Users\user\anaconda3\envs\geminiapi\lib\site-packages\gemini\core.py:114](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:114), in Gemini._initialize_session(self)
[111](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:111) elif self.auto_cookies == True:
[112](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:112) self._set_cookies_automatically()
--> [114](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:114) self._set_sid_and_nonce()
[116](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:116) return session
File [c:\Users\user\anaconda3\envs\geminiapi\lib\site-packages\gemini\core.py:162](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:162), in Gemini._set_sid_and_nonce(self)
[160](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:160) raise ConnectionError(f"Request failed: {e}")
[161](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:161) except ValueError as e:
--> [162](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:162) raise e # Re-raise the exception after it's caught
...
[160](file:///C:/Users/user/anaconda3/envs/geminiapi/lib/site-packages/gemini/core.py:160) raise ConnectionError(f"Request failed: {e}")
ValueError: Failed to parse SNlM0e nonce value from the response.
Refresh the Gemini web page or access Gemini in a new incognito browser to resend cookies.
If issue continues, export browser cookies, set manually. See auth section 3.
from gemini-api.
- Cookie behavior may vary based on location and Google account settings. Try cookies beyond the next set.
- However, automated cookie collection requires further experimentation.
- Even valid cookies may not work on different servers. Removing all accounts synced with Chrome and trying a new account is advised.
- If the issue persists, refer to section 3 at Gemini API Authentication for instructions on re-entering cookie values. Note, even valid cookies may fail depending on the server, PC, or account sync status. Experiment with different approaches.
Firstly, try this codes as sequencially:
from gemini import Gemini
GeminiClient = Gemini(auto_cookies=True)
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSIDCC"])
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSID", "__Secure-1PSIDTS"])
GeminiClient = Gemini(auto_cookies=True, target_cookies = ["__Secure-1PSIDCC", " __Secure-1PSID", "__Secure-1PSIDTS", "NID"])
response = GeminiClient.generate_content("Hello, Gemini. What's the weather like in Seoul today?")
print(response.payload)
from gemini-api.
Hello! Is it possible to use the automatic collection option on a remote server without GUI?
from gemini-api.
This is what I plan to fix. I will check RotateCookie endpoint!
I have importanct interview tomorrow! Thus, I will fix that issue until next weekend. Try to check this code https://github.com/dsdanielpark/Gemini-API?tab=readme-ov-file Reqid may not be useful.
from gemini-api.
Hot fixed this issue at v2.3.0
.
Try to use version over 2.3.0
pip install python-gemini-api==2.2.0
or
pip install -q -U python-gemini-api
from gemini-api.
Very thanks
from gemini-api.
Problem Fixed but new Problem is shown 😑🤣
ValueError: Failed to parse SNlM0e nonce value from the response.
Refresh the Gemini web page or access Gemini in a new incognito browser to resend cookies.
If issue continues, export browser cookies, set manually. See auth section 3.
from gemini-api.
OK very thanks for answering me:)
from gemini-api.
Related Issues (20)
- 1.0.0 not working HOT 5
- Notice: To Bard API Contributors
- 'NoneType' object has no attribute 'group' HOT 8
- The response text is a empty URL, which cannot be seen. {'metadata': ['c_cd648c1c943cb00f', 'r_f093111e78855c35'], 'candidates': {'rcid': 'rc_97ec8a9d7ddbed62', 'text': 'http://googleusercontent.com/card_content/0', 'web_images': [], 'generated_images': []}} HOT 8
- Image Generation issue HOT 4
- Opening new chat session for every prompts HOT 7
- Gemini to Gemini Advanced? HOT 2
- It returns message "maximum recursion depth exceeded" HOT 14
- Currently, nowhere on here where it states you require loguru HOT 4
- Unable to reuse sessions. HOT 1
- Input should be a valid list [type=list_type, input_value='Gönderilen resimde "Saf...ihtimalini artırıyor.', input_type=str] HOT 4
- Still not usable HOT 6
- Response None HOT 3
- SNlM0e token value not found. Double-check cookies dict value or pass it as Gemini(cookies=Dict()) HOT 4
- Notice: Reverse Engineering and Feature Testing Ongoing Until April 1, 2024 HOT 2
- Exception: SNlM0e token value not found. Double-check cookies dict value or pass it as Gemini(cookies=Dict()) HOT 4
- ImportError: cannot import name 'GeminiClient' from 'gemini' HOT 2
- AttributeError: 'Gemini' object has no attribute '_set_session' HOT 1
- Response in 0.1.6 as a string HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gemini-api.