Agora-Lab-AI / Dalle3

An API for DALLE-3
https://discord.gg/qUtxnK2NMf
MIT License
185 stars 14 forks source link

InvalidArgumentException: Message: invalid argument: missing 'value' #12

Closed ignaciosuchUOC closed 11 months ago

ignaciosuchUOC commented 11 months ago

When I use the Example code you provide:

`

import os import logging from dalle3 import Dalle

cookie = os.getenv("16OIrOlIoTP5fqH8GhswDQ67f_Q4T-hyBZwnVzlhEg8oZE4B2jVEwa1Sog9mis_8lVS_XM8KPRHOZuyePRHXm55-lOANcfivACBuuBaqQ29kRL_lxzM343TMR95c9Kr3gYylpyzgm41iUO4r3o0Rrowcw30XIgF9rYcthyWPW9Dw0azAmFSCgOJM7G07l9lA_EUdNvWn1spdHYI3arFbV4g")

logging.basicConfig(level=logging.INFO)

dalle = Dalle(cookie)

dalle.create( "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery" )

urls = dalle.get_urls()`

It returns this message:

could not detect version_main.therefore, we are assuming it is chrome 108 or higher Started executable: C:\Users\Isuch\appdata\roaming\undetected_chromedriver\undetected_chromedriver.exe in a child process with pid: 12564 POST http://localhost:52674/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "goog:chromeOptions": {"extensions": [], "binary": "C:\Program Files\Google\Chrome\Application\chrome.exe", "args": ["--disable-blink-features=AutomationControlled", "--remote-debugging-host=127.0.0.1", "--remote-debugging-port=52673", "--user-data-dir=C:\Users\IGNACI~1\AppData\Local\Temp\tmp9w7qfeaa", "--lang=es-ES", "--no-default-browser-check", "--no-first-run", "--no-sandbox", "--test-type", "--headless=new", "--window-size=1920,1080", "--start-maximized", "--no-sandbox", "--log-level=0"], "debuggerAddress": "127.0.0.1:52673"}}}} Starting new HTTP connection (1): localhost:52674 http://localhost:52674/ "POST /session HTTP/1.1" 200 0 Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"118.0.5993.89","chrome":{"chromedriverVersion":"118.0.5993.70 (e52f33f30b91b4ddfad649acddc39ab570473b86-refs/branch-heads/5993@{#1216})"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"127.0.0.1:52673"},"pageLoadStrategy":"normal","platformName":"","proxy":{},"setWindowRect":false,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:extension:minPinLength":true,"webauthn:extension:prf":true,"webauthn:virtualAuthenticators":true},"sessionId":"db78f584ef599cf1edb53c83ab073138"}} | headers=HTTPHeaderDict({'Content-Length': '760', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'}) Finished Request POST http://localhost:52674/session/db78f584ef599cf1edb53c83ab073138/execute/sync {"script": "return navigator.webdriver", "args": []} http://localhost:52674/ "POST /session/db78f584ef599cf1edb53c83ab073138/execute/sync HTTP/1.1" 200 0 Remote response: status=200 | data={"value":false} | headers=HTTPHeaderDict({'Content-Length': '15', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'}) Finished Request POST http://localhost:52674/session/db78f584ef599cf1edb53c83ab073138/url {"url": "https://www.bing.com/images/create?q=Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery"} http://localhost:52674/ "POST /session/db78f584ef599cf1edb53c83ab073138/url HTTP/1.1" 200 0 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'}) Finished Request [18/10/2023 10:50:52] Bing Image Creator (Dalle-3) Opened POST http://localhost:52674/session/db78f584ef599cf1edb53c83ab073138/cookie {"cookie": {"name": "_U", "value": null}} http://localhost:52674/ "POST /session/db78f584ef599cf1edb53c83ab073138/cookie HTTP/1.1" 400 0 Remote response: status=400 | data={"value":{"error":"invalid argument","message":"invalid argument: missing 'value'\n (Session info: chrome=118.0.5993.89)","stacktrace":"\tGetHandleVerifier [0x002C4DE3+43907]\n\t(No symbol) [0x00250741]\n\t(No symbol) [0x001433ED]\n\t(No symbol) [0x001B276B]\n\t(No symbol) [0x00192B5C]\n\t(No symbol) [0x001A55CA]\n\t(No symbol) [0x00192956]\n\t(No symbol) [0x0016E17E]\n\t(No symbol) [0x0016F32D]\n\tGetHandleVerifier [0x00575AF9+2865305]\n\tGetHandleVerifier [0x005BE78B+3163435]\n\tGetHandleVerifier [0x005B8441+3138017]\n\tGetHandleVerifier [0x0034E0F0+605840]\n\t(No symbol) [0x0025A64C]\n\t(No symbol) [0x00256638]\n\t(No symbol) [0x0025675F]\n\t(No symbol) [0x00248DB7]\n\tBaseThreadInitThunk [0x76BBFCC9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77BA7C6E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77BA7C3E+238]\n\t(No symbol) [0x00000000]\n"}} | headers=HTTPHeaderDict({'Content-Length': '858', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'}) Finished Request

InvalidArgumentException Traceback (most recent call last) Cell In[6], line 16 13 dalle = Dalle(cookie) 15 # Open the website with your query ---> 16 dalle.create( 17 "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery" 18 ) 20 # Get the image URLs 21 urls = dalle.get_urls()

File C:\Anaconda\envs\Dalle\Lib\site-packages\dalle3\dalle.py:111, in Dalle.create(self, query) 108 self.driver.get(f"https://www.bing.com/images/create?q={query}") 109 logging.info(f"{self.get_time()} Bing Image Creator (Dalle-3) Opened") --> 111 self.driver.add_cookie(cookie) 112 self.driver.refresh() 113 logging.info(f"{self.get_time()} Cookie values added ")

File C:\Anaconda\envs\Dalle\Lib\site-packages\selenium\webdriver\remote\webdriver.py:633, in WebDriver.add_cookie(self, cookie_dict) 631 self.execute(Command.ADD_COOKIE, {"cookie": cookie_dict}) 632 else: --> 633 self.execute(Command.ADD_COOKIE, {"cookie": cookie_dict})

File C:\Anaconda\envs\Dalle\Lib\site-packages\selenium\webdriver\remote\webdriver.py:344, in WebDriver.execute(self, driver_command, params) 342 response = self.command_executor.execute(driver_command, params) 343 if response: --> 344 self.error_handler.check_response(response) 345 response["value"] = self._unwrap_value(response.get("value", None)) 346 return response

File C:\Anaconda\envs\Dalle\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:229, in ErrorHandler.check_response(self, response) 227 alert_text = value["alert"].get("text") 228 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here --> 229 raise exception_class(message, screen, stacktrace)

InvalidArgumentException: Message: invalid argument: missing 'value' (Session info: chrome=118.0.5993.89) Stacktrace: GetHandleVerifier [0x002C4DE3+43907] (No symbol) [0x00250741] (No symbol) [0x001433ED] (No symbol) [0x001B276B] (No symbol) [0x00192B5C] (No symbol) [0x001A55CA] (No symbol) [0x00192956] (No symbol) [0x0016E17E] (No symbol) [0x0016F32D] GetHandleVerifier [0x00575AF9+2865305] GetHandleVerifier [0x005BE78B+3163435] GetHandleVerifier [0x005B8441+3138017] GetHandleVerifier [0x0034E0F0+605840] (No symbol) [0x0025A64C] (No symbol) [0x00256638] (No symbol) [0x0025675F] (No symbol) [0x00248DB7] BaseThreadInitThunk [0x76BBFCC9+25] RtlGetAppContainerNamedObjectPath [0x77BA7C6E+286] RtlGetAppContainerNamedObjectPath [0x77BA7C3E+238] (No symbol) [0x00000000]

kyegomez commented 11 months ago

@ignaciosuchUOC You're not putting your cookie in the cookie variable, ENV doesn't work sometimes!