Closed Flashbaurger888888 closed 4 weeks ago
@Flashbaurger888888, hello!
Thanks for reaching out. From the error output, it looks like the incorrect client UUID was provided. There are some strange features in the 3x-ui API behavior: E.g. when getting the client from API you'll receive a numerical client ID (e.g. 1, 2, 3), but when updating the client you need to provide its UUID.
Here's code reference for updating a client to set a traffic limit:
async def some_other_function():
user_uuid = str(uuid.uuid4())
new_client = Client(id=user_uuid, email=str(telegram_id), enable=True)
await api.client.add(inbound.id, [new_client])
await set_traffic_limit(telegram_id, user_uuid)
async def set_traffic_limit(telegram_id: int, user_uuid: str) -> None:
client = await api.client.get_by_email(str(telegram_id))
client.id = user_uuid
client.total_gb = gigabytes_to_bytes(Settings().traffic_limit)
await api.client.update(user_uuid, client)
Pay attention to the line client.id = user_uuid
.
Could you please confirm that the correct client UUID was set before making an API call?
Thank you Sincerely
Here's a screenshot from the panel for reference:
@Flashbaurger888888 I've also added a new FAQ section to discussions, it also includes your case, I believe. https://github.com/iwatkot/py3xui/discussions
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
Hi, i want to update my client with this api but it occurs error:
I've tried 2.3.9, 2.3.10 and 2.3.11 before but no one couldn't help me, also the client update example did not work either.