Skip to main content

PyXUI Async

An application with python that allows you to modify your xui panel (Sanaeii 3x-ui)

How To Install

pip install pyxui_async

How To Use

  • Import pyxui in your .py file
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
    token='D28asdlj238jasldf2asdf' # new version panel
)
  • Login in your panel (old version panel)
from pyxui_async.errors import BadLogin

try:
   await xui.login(USERNAME, PASSWORD)
except BadLogin:
    ...
  • Get inbounds list
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
new_id = await xui.get_new_uuid()
get = await xui.add_clients(
    inbound_id=1,
    client_settings=ClientSettings(clients=[Client(
        id=new_id.obj.uuid,
        email="example@gmal.com",
        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
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:
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:
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:
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

    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/'
    )

Metadata

Release files for pyxui-async 3.0.1

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

Source distribution (sdist)

Source distribution for pyxui-async 3.0.1
File Size Uploaded
pyxui_async-3.0.1.tar.gz 17.8 kB Details

Release files / pyxui_async-3.0.1.tar.gz

Download URL pyxui_async-3.0.1.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6eafddffa6453cbe9cfd3ed20f8681c7b7483d542f3906e030d17fee6afce763
BLAKE2b-256 checksum
How to use checksums
fe140436382e6958b3ca179e169c8830b95fab4528c1912e2d914383dd088d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

3.0.1 This release

1 release file

2.0.9

1 release file

2.0.8

1 release file

2.0.7

1 release file

2.0.6

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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