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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxui_async-3.0.1.tar.gz | 17.8 kB | Without provenance | Details for pyxui_async-3.0.1.tar.gz |
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
|
Security for pyxui-async 3.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.