Skip to main content

multi_3x_ui

A tool for managing multiple 3x-ui panels at once

PyPI version
Python Versions
License


Note: Secret token feature was removed from 3x-ui in 2.6.0. From now this feature doesn't supported by py_multi_3xui and py3xui. Please, edit your constructors and databases


📚 Table of Contents


📖 Overview

This module is based on py3xui.

Used dependencies:

  • py3xui for connecting and managing 3xui panels
    • requests for synchronous API
    • httpx for asynchronous API
    • pydantic for models
  • diskcache for storing 3xui cookies
  • pyotp for getting OTP passwords based on string

Supported Python Versions:

  • 3.11
  • 3.12

License: MIT License

3x-ui is under development. py3xui also. I am not related with 3x-ui or py3xui. This project is only for educational purposes


🚀 Quick Start

💾 Installation

pip install py_multi_3xui

⚙️ Operating with servers

➕ Adding server to database

from py_multi_3xui import Server
from py_multi_3xui import ServerDataManager

username = "Ben"
password = "BenLoveApples123"
host = "https://benserver.com:PORT/PATH/"
internet_speed = 5  # amount in gb per second.
location = "usa"
secret_token_for_2FA = "32secretbase32"

server = Server(admin_username=username,
                password=password,
                host=host,
                location=location,
                internet_speed=internet_speed,
                use_tls_verification=True,
                secret_token_for_2FA=secret_token_for_2FA)

data_manager = ServerDataManager()
data_manager.add_server(server)

💡 Learn your server's traffic speed by using Ookla or ask your VPS seller.
⚠ There is no filtration by valid country code. You can add some silly locations to db


❌ Deleting server from database

from py_multi_3xui import ServerDataManager

host = "some_server.com:PORT/PATH/"
manager = ServerDataManager()
manager.delete_server(host)

🌍 Get best server by country

from py_multi_3xui import ServerDataManager

manager = ServerDataManager()
location = "usa"
best_server = await manager.choose_best_server_by_location(location)
print(best_server)

👥 Working with clients/configs

🆕 Generate client (not add)

from py_multi_3xui import RandomStuffGenerator as rsg
from py_multi_3xui import Server
from py3xui import Client

total_gb = 30
inbound_id = 4
limit_ip = 0
client_email = rsg.generate_email(10)
expiry_time = 30
up = 0
down = 0

#note, generate. NOT ADD. This method returns only client instance
client = Server.generate_client(total_gb=total_gb,
                                inbound_id=inbound_id,
                                limit_ip=limit_ip,
                                client_email=client_email,
                                expiry_time=expiry_time,
                                up=up,
                                down=down)

For more complete info about py3xui.Client visit py3xui documentation.


➕ Add client to server

from py_multi_3xui import Server
from py3xui import Client

server = ...
client = ...

await server.add_client(client)

✏️ Edit/Update client

from py3xui import Client
from py_multi_3xui import Server

server = ...
client = await server.get_client_by_email("some_email")
client.up = 50
client.down = 30#just edit some client's fields

server.update_client(client)

🔑 Get connection string

from py_multi_3xui import Server
from py3xui import Client
server = ...
client = ...
remark = "MyAwesomeVPN"
port = 443# standard port for VLESS+Reality combo
config = server.get_config(client,remark,port)

🗑 Delete client by uuid

server = ...
uuid = "some uuid"
inbound_id = 4
server.delete_client_by_uuid(client_uuid=uuid, inbound_id=inbound_id)

🐞 Bugs and Features

Please report any bugs or feature requests by opening an issue on GitHub issues
Or DM me via Telegram(through DM to channel): @dmeetprofile


❤️ Donate and Support

If this project was helpful for you:

  • ⭐ Star it on GitHub
  • 💰 Donate via CryptoBot
  • 💎 Ton: UQCOKDO9dRYNe3Us8FDK2Ctz6B4fhsonaoKpK93bqneFAyJL

📌 Plans

  • Add manual
  • Add ability to work not only with VLESS+Reality configs
  • Improve database (add encryption, verification and etc)

Metadata

Release files for py-multi-3xui 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-multi-3xui 1.2.2
File Size Uploaded
py_multi_3xui-1.2.2.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-multi-3xui 1.2.2
File Interpreter ABI Platform
py_multi_3xui-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / py_multi_3xui-1.2.2.tar.gz

Download URL py_multi_3xui-1.2.2.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
55ea2bcd92b036c668608fade5d09641f46ab9fdc79163e3a3de50b5e0b14364
BLAKE2b-256 checksum
How to use checksums
dc950c389325af3ca188f1015722cf5462e8d67df14bc780bcb700518cacf090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / py_multi_3xui-1.2.2-py3-none-any.whl

Download URL py_multi_3xui-1.2.2-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
757ef4baf7a03d81db047ecc677a1430a7215a1bebcc8514045195c40318dde8
BLAKE2b-256 checksum
How to use checksums
a0fbb410b6055efb021be11feb226885dbd7ba9b583e1c2687959a5617e382a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.43

2 release files

0.0.42

2 release files

0.0.41

2 release files

0.0.40

2 release files

0.0.37

2 release files

0.0.36

2 release files

0.0.35

2 release files

0.0.34

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page