diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-11 07:47:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 07:47:35 +0100 |
commit | 0b850ac9fcabc52fecdeea8d56e620e44b35d180 (patch) | |
tree | f92578686f34476be49422889d4587d8f3cf2fa6 /g4f/Provider/bing | |
parent | Merge pull request #1670 from xtekky/xtekky-patch-1 (diff) | |
parent | Fix HuggingChat and PerplexityLabs and add HuggingFace provider (diff) | |
download | gpt4free-0.2.3.1.tar gpt4free-0.2.3.1.tar.gz gpt4free-0.2.3.1.tar.bz2 gpt4free-0.2.3.1.tar.lz gpt4free-0.2.3.1.tar.xz gpt4free-0.2.3.1.tar.zst gpt4free-0.2.3.1.zip |
Diffstat (limited to 'g4f/Provider/bing')
-rw-r--r-- | g4f/Provider/bing/create_images.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/g4f/Provider/bing/create_images.py b/g4f/Provider/bing/create_images.py index f6a8a372..cb357708 100644 --- a/g4f/Provider/bing/create_images.py +++ b/g4f/Provider/bing/create_images.py @@ -20,7 +20,7 @@ except ImportError: from ...providers.create_images import CreateImagesProvider from ..helper import get_connector from ...providers.types import ProviderType -from ...errors import MissingRequirementsError +from ...errors import MissingRequirementsError, RateLimitError from ...webdriver import WebDriver, get_driver_cookies, get_browser BING_URL = "https://www.bing.com" @@ -125,6 +125,8 @@ async def create_images(session: ClientSession, prompt: str, proxy: str = None, async with session.post(url, allow_redirects=False, data=payload, timeout=timeout) as response: response.raise_for_status() text = (await response.text()).lower() + if "0 coins available" in text: + raise RateLimitError("No coins left. Log in with a different account or wait a while") for error in ERRORS: if error in text: raise RuntimeError(f"Create images failed: {error}") |