summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/bing
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-11 02:41:59 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-11 02:41:59 +0100
commitec51e9c76433b9e9498ade1dbe5de2268ad84218 (patch)
tree2876e373144f025949477601e89b8d478a49fafc /g4f/Provider/bing
parentAdd word count from iG8R (diff)
downloadgpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar.gz
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar.bz2
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar.lz
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar.xz
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.tar.zst
gpt4free-ec51e9c76433b9e9498ade1dbe5de2268ad84218.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/bing/create_images.py4
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}")