diff --git a/README.md b/README.md index a089e24..ef7ea54 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ options: -h, --help show this help message and exit -U U Auth cookie from browser --prompt PROMPT Prompt to generate images for + --asyncio Use async to sync png --output-dir OUTPUT_DIR Output directory ``` diff --git a/src/BingImageCreator.py b/src/BingImageCreator.py index 4420787..0c971f2 100644 --- a/src/BingImageCreator.py +++ b/src/BingImageCreator.py @@ -144,6 +144,7 @@ def __init__(self, auth_cookie: str, quiet: bool = False) -> None: self.session = aiohttp.ClientSession( headers=HEADERS, cookies={"_U": auth_cookie}, + trust_env=True, ) self.quiet = quiet @@ -201,7 +202,7 @@ async def get_images(self, prompt: str) -> list: if response.status != 200: raise Exception("Could not get results") content = await response.text() - if content: + if content and content.find("errorMessage") == -1: break await asyncio.sleep(1)