kramcat / CharacterAI

Unofficial Python API for character.ai
https://docs.kram.cat
MIT License
378 stars 52 forks source link

pydantic_core._pydantic_core.ValidationError: 1 validation error for Profile name #100

Closed ibnaleem closed 2 months ago

ibnaleem commented 2 months ago
import asyncio
from characterai import aiocai, sendCode, authUser

async def main():
    email = input('YOUR EMAIL: ')

    code = sendCode(email)

    link = input('CODE IN MAIL: ')

    token = authUser(link, email)

    info = await aiocai.get_me(token=token)

    print(info)

asyncio.run(main())
Traceback (most recent call last):
  File "/Users/****/local/****/main.py", line 17, in <module>
    asyncio.run(main())
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/****/local/****/main.py", line 13, in main
    info = await aiocai.get_me(token=token)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/myvenv/lib/python3.12/site-packages/characterai/aiocai/methods/utils.py", line 130, in wrapper
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/myvenv/lib/python3.12/site-packages/characterai/aiocai/methods/account.py", line 31, in get_me
    return account.Profile.model_validate(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/myvenv/lib/python3.12/site-packages/pydantic/main.py", line 532, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Profile
name
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type
kramcat commented 2 months ago

pip uninstall characterai pip install git+https://github.com/kramcat/characterai.git

ibnaleem commented 2 months ago
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
kramcat commented 2 months ago

Send full error and code

ibnaleem commented 2 months ago

Nevermind, it worked, thank you