MULTI-ON/cookbook

Task scheluder example error.

Closed this issue · 1 comments

After setting up task scheluder, i can't login to multion.

task-scheduler-py3.10) C:\Users\hu\Documents\multion_exampels\examples\task_scheduler>python scheduler_application.py
Getting OpenAI API Key...
Submitted API key:  SECRET
Set OPENAI_API_KEY:  SECRET
Exception in thread Thread-2 (login):
Traceback (most recent call last):
  File "C:\Users\hu\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\hu\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 300, in login
    _multion_instance.login()
  File "C:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 72, in login
    self.client_id = self.register_client()
  File "C:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 105, in register_client
    raise Exception("Failed to register client")
Exception: Failed to register client

After adding multion_token.txt with multion token i have errors:

Thread is still running. Closing the thread.
An error occurred when calling message handler
Traceback (most recent call last):
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\pystray\_win32.py", line 401, in _dispatcher
    return int(icon._message_handlers.get(
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\pystray\_win32.py", line 213, in _on_notify
    descriptors[index - 1](self)
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\pystray\_base.py", line 324, in inner
    callback(self)
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\pystray\_base.py", line 449, in __call__
    return self._action(icon, self)
  File "C:\Users\ha\Documents\multion_exampels\examples\task_scheduler\scheduler_application.py", line 590, in after_click
    login_multion()
  File "C:\Users\ha\Documents\multion_exampels\examples\task_scheduler\scheduler_application.py", line 444, in login_multion
    multion_login()
  File "C:\Users\ha\Documents\multion_exampels\examples\task_scheduler\scheduler_application.py", line 97, in multion_login
    t1.cancel()
AttributeError: 'Thread' object has no attribute 'cancel'
Exception in thread Thread-2 (login):
Traceback (most recent call last):
  File "C:\Users\ha\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\ha\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 300, in login
    _multion_instance.login()
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 72, in login
    self.client_id = self.register_client()
  File "C:\Users\ha\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 105, in register_client
    raise Exception("Failed to register client")
Exception: Failed to register client

When i use poetry and .env file with keys - i also have error:

PS C:\Users\hu\Documents\multion_exampels\examples\task_scheduler>  c:; cd 'c:\Users\hu\Documents\multion_exampels\examples\task_scheduler'; & 'c:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\Scripts\python.exe' 'c:\Users\hu\.vscode\extensions\ms-python.debugpy-2024.1.10371006-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '54935' '--' 'C:\Users\hu\Documents\multion_exampels\examples\task_scheduler\scheduler_application.py' 
Set OPENAI_API_KEY: 
Exception in thread Thread-7 (login):
Traceback (most recent call last):
  File "C:\Users\hu\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\hu\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "c:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 300, in login
    _multion_instance.login()
  File "c:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 72, in login
    self.client_id = self.register_client()
  File "c:\Users\hu\AppData\Local\pypoetry\Cache\virtualenvs\task-scheduler-KfTrUDer-py3.10\lib\site-packages\multion\multion.py", line 105, in register_client
    raise Exception("Failed to register client")
Exception: Failed to register client

@hackgoofer @0xmmo @omarshaya @tjdharani

Problem is here

    def register_client(self):
        response = requests.post("https://api.multion.ai/register_client")
        print(response)
        if response.status_code == 200:
            data = response.json()
            return data.get("client_id")
        else:
            print(response)
            raise Exception("Failed to register client")

Logs:

<Response [404]>
<Response [404]>