pyxui-async


Namepyxui-async JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/ARLIKIN/pyxui_async
SummaryAn application with python that allows you to modify your xui panel
upload_time2025-09-19 12:30:49
maintainerNone
docs_urlNone
authorStaliox, ARLIKIN
requires_pythonNone
licenseMIT
keywords pyxui async xui xui python xui panel
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyXUI Async
An application with python that allows you to modify your xui panel ([Sanaeii 3x-ui](https://github.com/MHSanaei/3x-ui)) 

## How To Install
```
pip install pyxui_async
```

## How To Use
- Import pyxui in your .py file

```python
from pyxui_async import XUI

xui = XUI(
    full_address="http://staliox.site:2087",
    panel="sanaei",  # Your panel name "sanaei"
    https=False,  # Make note if you don't use https set False else set True
    timeout=30 # timeout connect
)
```

- Login in your panel

```python
from pyxui_async.errors import BadLogin

try:
   await xui.login(USERNAME, PASSWORD)
except BadLogin:
    ...
```

- Get inbounds list
```python
get_inbounds = await xui.get_inbounds()

# Result is object InboundsResponse
class InboundsResponse(ResponseBase):
    success: bool
    msg: str
    obj: List[
        id: int
        up: int
        down: int
        total: int
        allTime: Optional[int] = None
        remark: str
        enable: bool
        expiryTime: int
        clientStats: Optional[List[InboundClientStats]] = []
        listen: str
        port: int
        protocol: str
        settings: InboundSettings
        streamSettings: Optional[StreamSettings] = None
        tag: str
        sniffing: Sniffing
    ]
```

- Add client to the existing inbound
```python
get = await xui.add_clients(
    inbound_id=1,
    client_settings=ClientSettings(clients=[Client(
        email="example@gmal.com",
        id="5d3d1bac-49cd-4b66-8be9-a728efa205fa",
        flow = "xtls-rprx-vision",
        subscription_id = "Asaw3ras3asdfa1was"
    )])
)
```
If you add trojan or ShadowSoks, you must specify a password for the id.

- Update the existing client
```python
get = await xui.update_client(
    inbound_id=1,
    email="example@gmal.com",
    uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa",
    enable = True,
    flow = "",
    limit_ip = 0,
    total_gb = 5368709120,
    expire_time = 1684948641772,
    telegram_id = "",
    subscription_id = ""
)
```

- Get client's information:
```python
get_client = await xui.get_client(
    inbound_id=1,
    email="Me",
)

# Result
class Client(BaseModel):
    id: Optional[str] = ""
    flow: Optional[str] = ""
    email: str
    limitIp: Optional[int] = 0
    totalGB: Optional[int] = 0
    expiryTime: Optional[int] = 0
    enable: Optional[bool] = True
    tgId: Optional[Any] = ""
    subId: Optional[str] = ""
    reset: Optional[int] = 0
    comment: Optional[str] = ""
    security: Optional[str] = ""
    password: Optional[str] = ""
    created_at: Optional[int] = None
    updated_at: Optional[int] = None
```

- Get client's statistics:
```python
get_client = await xui.get_client_stat(
    inbound_id=1,
    email="Me",
)

# Result
class InboundClientStats(BaseModel):
    id: int
    inboundId: int
    enable: bool
    email: str
    up: int
    down: int
    allTime: Optional[int] = None
    expiryTime: int
    total: int
    reset: int
    lastOnline: Optional[int] = None
```

- Delete client from the existing inbound:
```python
get_client = await xui.delete_client(
    inbound_id=1,
    email="Me",
    uuid="5d3d1bac-49cd-4b66-8be9-a728efa205fa" # Make note you don't have to pass both of them (email, uuid), just one is enough
)
```

# Create config string
```python
    key_vless = await xui.get_key_vless(inbound_id=1, email='email', custom_remark='Mary')
    key_trojan = await xui.get_key_trojan(inbound_id=2, email='email', custom_remark='Elsa')
    key_shadow_soks = await xui.get_key_shadow_socks(inbound_id=3, email='email', custom_remark='Dani')
    sub_url = await xui.get_subscription_link(
        inbound_id=4, email='email', https=True, port=443, sub_path='/myserver/'
    )
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ARLIKIN/pyxui_async",
    "name": "pyxui-async",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pyxui async, xui, xui python, xui panel",
    "author": "Staliox, ARLIKIN",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a7/18/1a1883e02583313a6375b30c28e677635ee8fc81f13c281c6fdc44ae6039/pyxui_async-2.0.0.tar.gz",
    "platform": null,
    "description": "# PyXUI Async\nAn application with python that allows you to modify your xui panel ([Sanaeii 3x-ui](https://github.com/MHSanaei/3x-ui)) \n\n## How To Install\n```\npip install pyxui_async\n```\n\n## How To Use\n- Import pyxui in your .py file\n\n```python\nfrom pyxui_async import XUI\n\nxui = XUI(\n    full_address=\"http://staliox.site:2087\",\n    panel=\"sanaei\",  # Your panel name \"sanaei\"\n    https=False,  # Make note if you don't use https set False else set True\n    timeout=30 # timeout connect\n)\n```\n\n- Login in your panel\n\n```python\nfrom pyxui_async.errors import BadLogin\n\ntry:\n   await xui.login(USERNAME, PASSWORD)\nexcept BadLogin:\n    ...\n```\n\n- Get inbounds list\n```python\nget_inbounds = await xui.get_inbounds()\n\n# Result is object InboundsResponse\nclass InboundsResponse(ResponseBase):\n    success: bool\n    msg: str\n    obj: List[\n        id: int\n        up: int\n        down: int\n        total: int\n        allTime: Optional[int] = None\n        remark: str\n        enable: bool\n        expiryTime: int\n        clientStats: Optional[List[InboundClientStats]] = []\n        listen: str\n        port: int\n        protocol: str\n        settings: InboundSettings\n        streamSettings: Optional[StreamSettings] = None\n        tag: str\n        sniffing: Sniffing\n    ]\n```\n\n- Add client to the existing inbound\n```python\nget = await xui.add_clients(\n    inbound_id=1,\n    client_settings=ClientSettings(clients=[Client(\n        email=\"example@gmal.com\",\n        id=\"5d3d1bac-49cd-4b66-8be9-a728efa205fa\",\n        flow = \"xtls-rprx-vision\",\n        subscription_id = \"Asaw3ras3asdfa1was\"\n    )])\n)\n```\nIf you add trojan or ShadowSoks, you must specify a password for the id.\n\n- Update the existing client\n```python\nget = await xui.update_client(\n    inbound_id=1,\n    email=\"example@gmal.com\",\n    uuid=\"5d3d1bac-49cd-4b66-8be9-a728efa205fa\",\n    enable = True,\n    flow = \"\",\n    limit_ip = 0,\n    total_gb = 5368709120,\n    expire_time = 1684948641772,\n    telegram_id = \"\",\n    subscription_id = \"\"\n)\n```\n\n- Get client's information:\n```python\nget_client = await xui.get_client(\n    inbound_id=1,\n    email=\"Me\",\n)\n\n# Result\nclass Client(BaseModel):\n    id: Optional[str] = \"\"\n    flow: Optional[str] = \"\"\n    email: str\n    limitIp: Optional[int] = 0\n    totalGB: Optional[int] = 0\n    expiryTime: Optional[int] = 0\n    enable: Optional[bool] = True\n    tgId: Optional[Any] = \"\"\n    subId: Optional[str] = \"\"\n    reset: Optional[int] = 0\n    comment: Optional[str] = \"\"\n    security: Optional[str] = \"\"\n    password: Optional[str] = \"\"\n    created_at: Optional[int] = None\n    updated_at: Optional[int] = None\n```\n\n- Get client's statistics:\n```python\nget_client = await xui.get_client_stat(\n    inbound_id=1,\n    email=\"Me\",\n)\n\n# Result\nclass InboundClientStats(BaseModel):\n    id: int\n    inboundId: int\n    enable: bool\n    email: str\n    up: int\n    down: int\n    allTime: Optional[int] = None\n    expiryTime: int\n    total: int\n    reset: int\n    lastOnline: Optional[int] = None\n```\n\n- Delete client from the existing inbound:\n```python\nget_client = await xui.delete_client(\n    inbound_id=1,\n    email=\"Me\",\n    uuid=\"5d3d1bac-49cd-4b66-8be9-a728efa205fa\" # Make note you don't have to pass both of them (email, uuid), just one is enough\n)\n```\n\n# Create config string\n```python\n    key_vless = await xui.get_key_vless(inbound_id=1, email='email', custom_remark='Mary')\n    key_trojan = await xui.get_key_trojan(inbound_id=2, email='email', custom_remark='Elsa')\n    key_shadow_soks = await xui.get_key_shadow_socks(inbound_id=3, email='email', custom_remark='Dani')\n    sub_url = await xui.get_subscription_link(\n        inbound_id=4, email='email', https=True, port=443, sub_path='/myserver/'\n    )\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An application with python that allows you to modify your xui panel",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "https://github.com/ARLIKIN/pyxui_async"
    },
    "split_keywords": [
        "pyxui async",
        " xui",
        " xui python",
        " xui panel"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a7181a1883e02583313a6375b30c28e677635ee8fc81f13c281c6fdc44ae6039",
                "md5": "d7c969d264a4af0b593664f0a34402bf",
                "sha256": "308a1332deacf0bb750702ffebb0a2a4da2a69f302074eda4c66d4f4351e258e"
            },
            "downloads": -1,
            "filename": "pyxui_async-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d7c969d264a4af0b593664f0a34402bf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15015,
            "upload_time": "2025-09-19T12:30:49",
            "upload_time_iso_8601": "2025-09-19T12:30:49.434132Z",
            "url": "https://files.pythonhosted.org/packages/a7/18/1a1883e02583313a6375b30c28e677635ee8fc81f13c281c6fdc44ae6039/pyxui_async-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-19 12:30:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ARLIKIN",
    "github_project": "pyxui_async",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyxui-async"
}
        
Elapsed time: 1.07232s