iwatkot / py3xui

Sync and Async Object-oriented Python SDK for the 3x-ui API.
MIT License
22 stars 3 forks source link

error field type in Client object #21

Closed anmv closed 3 weeks ago

anmv commented 1 month ago

After I set the tgId through the web interface, I started receiving a type error:

settings.clients.4.tgId expected str, but got int.

I deleted the value from the field in the web interface, and now I'm getting an error saying it expects a string but gets None:

settings.clients.4.tgId
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.9/v/string_type
github-actions[bot] commented 1 month ago

Thank you for opening an issue!
Please, first check our FAQ section in discussions to see if your question has already been answered.
You can also use Discussion if you have any questions or suggestions, while the Issues section is for bug reports and feature requests.
If you want to proceed with the issue, please provide the following information:
- Description of the issue
- Expected behavior
- Actual behavior
- Steps to reproduce the issue
- Python version
- OS
- py3xui version
- 3x-UI version
- Code snippet or a minimal example to reproduce the issue (if applicable)
- JSON representation of the request to the API (if applicable)

Thank you!

anmv commented 1 month ago

python = 3.10.15

py3xui = 0.2.3

3x-UI version = v2.3.13

pydantic = 2.9.2

OS = MacOs 15.0 and Ubuntu 22.04

iwatkot commented 1 month ago

@anmv, hello and thank you for the report!

This one should be easy to fix, I guess it's just an incorrect typing in the pydantic model: str, while should be int | None.

I'm vacationing now and won't be able to check on this. So if you can check if changing the typing would help, you can open a PR with this minor change.

Sincerely

anmv commented 1 month ago

@iwatkot sure, no problem but i cant create new branch in repository maybe I doing something wrong...

ERROR: Permission to iwatkot/py3xui.git denied to anmv.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
iwatkot commented 1 month ago

@anmv hello! This documentation should help you with it.

iwatkot commented 3 weeks ago

@anmv, linked your PR to the issue, it will be automatically closed after merging.

Sincerely