Closed NoBanOnlyZXC closed 2 months ago
Please note that the work is still in progress, so there may be frequent errors. Thank you for your understanding!
I've encountered the same error while developing. I'm currently working on exception handling.
Probable Causes
Troubleshooting Solutions
auto_cookies=True
, please set it to False
and manually pass the cookies. The auto_cookies
feature is currently incomplete.Gemini(cookies=cookies)
and didn't receive an error, refrain from declaring the object again. Doing so will resend the request, potentially causing temporary errors due to rate limiting.generate_content
, please refrain from closing the Gemini web page and revisiting it.If you have google official api key from google ai studio. See this document. https://ai.google.dev/tutorials/python_quickstart
If you have google official api key from google ai studio. See this document. https://ai.google.dev/tutorials/python_quickstart
The official api key is not connected to the Internet and there is no Gemini Ultra, which can be used in the web version. This is why access to requests from the page is so important
This issue occurs because the __Secure-1PSIDTS cookie is updated every 30 minutes.
We need a mechanism to automatically remove it, but also for cases when requests are executed on a remote server, when there is no physical ability to keep the browser open.
I set the region to Ukraine and the USA - in each case this cookie was updated after 30 minutes.
@ dsdanielpark I installed GeminiAPI for the first time since last July during the BardAPI days. I followed the steps, but it has been failing with the same error since the first time. Isn't this error occurring on Google side due to a cookie issue, but an error in GeminiAPI's Python code? I'm getting an error with Python, so I don't think cookies, rate limits, accounts, or countries are involved. Actually, troubleshooting was pointless.
From Google Translate. I apologize for the unnatural English. I am grateful for your work.
In my case, it's likely that your experience is incorrect.
The error can occur when the received payload does not contain the specified cookie.
Currently, Google seems to apply stronger measures against repetitive requests than the previous Bard API, by either temporarily blocking them, caching some cookies without exposing them, or calling RotateCookie to prevent JSON hijacking.
I also experience the same error with repetitive requests after receiving normal responses.
1) If this error occurs, try to minimize the number of requests per hour as much as possible. If the error starts occurring, it's mostly a rate limiting issue.
2) Try using accounts from different countries (e.g., Ukraine) to attempt with all cookies, not just some.
3) Experiment with logging out and in, resetting the browser (incognito or private browsing), capture the cookie values, and create a client to ensure the generate_content results are returned correctly.
Various experiments may be needed, and if successful, it would be appreciated if you could document the process in an issue.
4) Once you receive the generate_content return successfully with a cookie value, close the gemini web in all browsers. If it remains open, the cookies may be refreshed, preventing the use of the original cookie values.
@ dsdanielpark
I installed GeminiAPI for the first time since last July during the BardAPI days.
I followed the steps, but it has been failing with the same error since the first time.
Isn't this error occurring on Google side due to a cookie issue, but an error in GeminiAPI's Python code?
I'm getting an error with Python, so I don't think cookies, rate limits, accounts, or countries are involved. Actually, troubleshooting was pointless.
From Google Translate. I apologize for the unnatural English. I am grateful for your work.
I will split package issues and API issues.
Please, give me a more time!
OK, thanksπͺ
ππ Thank you for interest. β€οΈπ Please make sure to check for more efficient package management.
To Reproduce
Describe the bug not working gemini, writes β
Version OS: Win11 Python: 3.11.7 Gemini API: usa Using proxy: no Legion:
Code
Error