py-multi-3xui


Namepy-multi-3xui JSON
Version 1.2.2 PyPI version JSON
download
home_pageNone
Summarymodule for managing multiple 3x-ui panels
upload_time2025-08-10 21:14:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords vpn 3x-ui vless reality vless+reality x-ui sdk py3xui x-ui proxy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div align="center">

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

[![PyPI version](https://img.shields.io/pypi/v/py_multi_3xui.svg)](https://pypi.org/project/py_multi_3xui/)  
[![Python Versions](https://img.shields.io/pypi/pyversions/py_multi_3xui.svg)](https://www.python.org/)  
[![License](https://img.shields.io/github/license/Dmeetrogon/py_multi_3xui.svg)](LICENSE)  

</div>

---

> **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](#overview)
- [Quick Start](#quick-start)
  - [Installation](#installation)
  - [Operating with servers](#operating-with-servers)
  - [Working with clients/configs](#working-with-clientsconfigs)
- [Bugs and Features](#bugs-and-features)
- [Donate and Support](#donate-and-support)
- [Plans](#plans)

---

## 📖 Overview
This module is based on **[py3xui](https://github.com/iwatkot/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
```bash
pip install py_multi_3xui
```

---

## ⚙️ Operating with servers

### ➕ Adding server to database
```python
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](https://www.speedtest.net/) 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
```python
from py_multi_3xui import ServerDataManager

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

---

### 🌍 Get best server by country
```python
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)
```python

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](https://github.com/iwatkot/py3xui)._

---

### ➕ Add client to server
```python
from py_multi_3xui import Server
from py3xui import Client

server = ...
client = ...

await server.add_client(client)
```

---

### ✏️ Edit/Update client
```python
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
```python
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
```python
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](https://github.com/Dmeetrogon/py_multi_3xui/issues)  
Or DM me via Telegram(through DM to channel): [@dmeetprofile](https://t.me/dmeetprofile)

---

## ❤️ Donate and Support
If this project was helpful for you:  
- ⭐ Star it on GitHub  
- 💰 Donate via [CryptoBot](https://t.me/send?start=IVFCR3tEjcyk)  
- 💎 Ton: `UQCOKDO9dRYNe3Us8FDK2Ctz6B4fhsonaoKpK93bqneFAyJL`

---

## 📌 Plans
- [ ] Add manual
- [ ] Add ability to work not only with VLESS+Reality configs
- [ ] Improve database (add encryption, verification and etc)  










            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-multi-3xui",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "vpn, 3x-ui, vless, reality, vless+reality, x-ui, SDK, py3xui, x-ui, proxy",
    "author": null,
    "author_email": "Dmeetrogon <dmeetrogon@egmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/dc/95/0c389325af3ca188f1015722cf5462e8d67df14bc780bcb700518cacf090/py_multi_3xui-1.2.2.tar.gz",
    "platform": null,
    "description": "\r\n<div align=\"center\">\r\n\r\n# multi_3x_ui  \r\n**A tool for managing multiple 3x-ui panels at once**  \r\n\r\n[![PyPI version](https://img.shields.io/pypi/v/py_multi_3xui.svg)](https://pypi.org/project/py_multi_3xui/)  \r\n[![Python Versions](https://img.shields.io/pypi/pyversions/py_multi_3xui.svg)](https://www.python.org/)  \r\n[![License](https://img.shields.io/github/license/Dmeetrogon/py_multi_3xui.svg)](LICENSE)  \r\n\r\n</div>\r\n\r\n---\r\n\r\n> **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\r\n\r\n---\r\n\r\n## \ud83d\udcda Table of Contents\r\n- [Overview](#overview)\r\n- [Quick Start](#quick-start)\r\n  - [Installation](#installation)\r\n  - [Operating with servers](#operating-with-servers)\r\n  - [Working with clients/configs](#working-with-clientsconfigs)\r\n- [Bugs and Features](#bugs-and-features)\r\n- [Donate and Support](#donate-and-support)\r\n- [Plans](#plans)\r\n\r\n---\r\n\r\n## \ud83d\udcd6 Overview\r\nThis module is based on **[py3xui](https://github.com/iwatkot/py3xui).** \r\n\r\n**Used dependencies:**\r\n- `py3xui` for connecting and managing 3xui panels  \r\n  - `requests` for synchronous API  \r\n  - `httpx` for asynchronous API  \r\n  - `pydantic` for models  \r\n- `diskcache` for storing 3xui cookies  \r\n- `pyotp` for getting OTP passwords based on string  \r\n\r\n**Supported Python Versions:**\r\n- `3.11`\r\n- `3.12`\r\n\r\n**License:** MIT License  \r\n\r\n> _3x-ui is under development. py3xui also. I am not related with 3x-ui or py3xui. This project is only for educational purposes_\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### \ud83d\udcbe Installation\r\n```bash\r\npip install py_multi_3xui\r\n```\r\n\r\n---\r\n\r\n## \u2699\ufe0f Operating with servers\r\n\r\n### \u2795 Adding server to database\r\n```python\r\nfrom py_multi_3xui import Server\r\nfrom py_multi_3xui import ServerDataManager\r\n\r\nusername = \"Ben\"\r\npassword = \"BenLoveApples123\"\r\nhost = \"https://benserver.com:PORT/PATH/\"\r\ninternet_speed = 5  # amount in gb per second.\r\nlocation = \"usa\"\r\nsecret_token_for_2FA = \"32secretbase32\"\r\n\r\nserver = Server(admin_username=username,\r\n                password=password,\r\n                host=host,\r\n                location=location,\r\n                internet_speed=internet_speed,\r\n                use_tls_verification=True,\r\n                secret_token_for_2FA=secret_token_for_2FA)\r\n\r\ndata_manager = ServerDataManager()\r\ndata_manager.add_server(server)\r\n```\r\n\r\n> \ud83d\udca1 Learn your server's traffic speed by using [Ookla](https://www.speedtest.net/) or ask your VPS seller.  \r\n> \u26a0 There is no filtration by valid country code. You can add some silly locations to db\r\n\r\n---\r\n\r\n### \u274c Deleting server from database\r\n```python\r\nfrom py_multi_3xui import ServerDataManager\r\n\r\nhost = \"some_server.com:PORT/PATH/\"\r\nmanager = ServerDataManager()\r\nmanager.delete_server(host)\r\n```\r\n\r\n---\r\n\r\n### \ud83c\udf0d Get best server by country\r\n```python\r\nfrom py_multi_3xui import ServerDataManager\r\n\r\nmanager = ServerDataManager()\r\nlocation = \"usa\"\r\nbest_server = await manager.choose_best_server_by_location(location)\r\nprint(best_server)\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udc65 Working with clients/configs\r\n\r\n### \ud83c\udd95 Generate client (not add)\r\n```python\r\n\r\nfrom py_multi_3xui import RandomStuffGenerator as rsg\r\nfrom py_multi_3xui import Server\r\nfrom py3xui import Client\r\n\r\ntotal_gb = 30\r\ninbound_id = 4\r\nlimit_ip = 0\r\nclient_email = rsg.generate_email(10)\r\nexpiry_time = 30\r\nup = 0\r\ndown = 0\r\n\r\n#note, generate. NOT ADD. This method returns only client instance\r\nclient = Server.generate_client(total_gb=total_gb,\r\n                                inbound_id=inbound_id,\r\n                                limit_ip=limit_ip,\r\n                                client_email=client_email,\r\n                                expiry_time=expiry_time,\r\n                                up=up,\r\n                                down=down)\r\n```\r\n> _For more complete info about **py3xui.Client** visit [py3xui documentation](https://github.com/iwatkot/py3xui)._\r\n\r\n---\r\n\r\n### \u2795 Add client to server\r\n```python\r\nfrom py_multi_3xui import Server\r\nfrom py3xui import Client\r\n\r\nserver = ...\r\nclient = ...\r\n\r\nawait server.add_client(client)\r\n```\r\n\r\n---\r\n\r\n### \u270f\ufe0f Edit/Update client\r\n```python\r\nfrom py3xui import Client\r\nfrom py_multi_3xui import Server\r\n\r\nserver = ...\r\nclient = await server.get_client_by_email(\"some_email\")\r\nclient.up = 50\r\nclient.down = 30#just edit some client's fields\r\n\r\nserver.update_client(client)\r\n```\r\n\r\n---\r\n\r\n### \ud83d\udd11 Get connection string\r\n```python\r\nfrom py_multi_3xui import Server\r\nfrom py3xui import Client\r\nserver = ...\r\nclient = ...\r\nremark = \"MyAwesomeVPN\"\r\nport = 443# standard port for VLESS+Reality combo\r\nconfig = server.get_config(client,remark,port)\r\n```\r\n\r\n---\r\n\r\n### \ud83d\uddd1 Delete client by uuid\r\n```python\r\nserver = ...\r\nuuid = \"some uuid\"\r\ninbound_id = 4\r\nserver.delete_client_by_uuid(client_uuid=uuid, inbound_id=inbound_id)\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udc1e Bugs and Features\r\nPlease report any bugs or feature requests by opening an issue on [GitHub issues](https://github.com/Dmeetrogon/py_multi_3xui/issues)  \r\nOr DM me via Telegram(through DM to channel): [@dmeetprofile](https://t.me/dmeetprofile)\r\n\r\n---\r\n\r\n## \u2764\ufe0f Donate and Support\r\nIf this project was helpful for you:  \r\n- \u2b50 Star it on GitHub  \r\n- \ud83d\udcb0 Donate via [CryptoBot](https://t.me/send?start=IVFCR3tEjcyk)  \r\n- \ud83d\udc8e Ton: `UQCOKDO9dRYNe3Us8FDK2Ctz6B4fhsonaoKpK93bqneFAyJL`\r\n\r\n---\r\n\r\n## \ud83d\udccc Plans\r\n- [ ] Add manual\r\n- [ ] Add ability to work not only with VLESS+Reality configs\r\n- [ ] Improve database (add encryption, verification and etc)  \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "module for managing multiple 3x-ui panels",
    "version": "1.2.2",
    "project_urls": {
        "Homepage": "https://github.com/Dmeetrogon/py_multi_3xui",
        "Issues": "https://github.com/Dmeetrogon/py_multi_3xui/issues"
    },
    "split_keywords": [
        "vpn",
        " 3x-ui",
        " vless",
        " reality",
        " vless+reality",
        " x-ui",
        " sdk",
        " py3xui",
        " x-ui",
        " proxy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a0fbb410b6055efb021be11feb226885dbd7ba9b583e1c2687959a5617e382a0",
                "md5": "4486e7544f075b294bbf155a637d5bcd",
                "sha256": "757ef4baf7a03d81db047ecc677a1430a7215a1bebcc8514045195c40318dde8"
            },
            "downloads": -1,
            "filename": "py_multi_3xui-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4486e7544f075b294bbf155a637d5bcd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 15387,
            "upload_time": "2025-08-10T21:14:39",
            "upload_time_iso_8601": "2025-08-10T21:14:39.647957Z",
            "url": "https://files.pythonhosted.org/packages/a0/fb/b410b6055efb021be11feb226885dbd7ba9b583e1c2687959a5617e382a0/py_multi_3xui-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dc950c389325af3ca188f1015722cf5462e8d67df14bc780bcb700518cacf090",
                "md5": "6cf1a71b978008eba9dee0b5e5d60943",
                "sha256": "55ea2bcd92b036c668608fade5d09641f46ab9fdc79163e3a3de50b5e0b14364"
            },
            "downloads": -1,
            "filename": "py_multi_3xui-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6cf1a71b978008eba9dee0b5e5d60943",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14401,
            "upload_time": "2025-08-10T21:14:41",
            "upload_time_iso_8601": "2025-08-10T21:14:41.051299Z",
            "url": "https://files.pythonhosted.org/packages/dc/95/0c389325af3ca188f1015722cf5462e8d67df14bc780bcb700518cacf090/py_multi_3xui-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-10 21:14:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dmeetrogon",
    "github_project": "py_multi_3xui",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-multi-3xui"
}
        
Elapsed time: 0.86662s