# xtlsapi
[![codecov](https://codecov.io/gh/hiddify/xtlsapi/branch/main/graph/badge.svg?token=xtlsapi_token_here)](https://codecov.io/gh/hiddify/xtlsapi)
[![CI](https://github.com/hiddify/xtlsapi/actions/workflows/main.yml/badge.svg)](https://github.com/hiddify/xtlsapi/actions/workflows/main.yml)
Python library to communicate with xray core
## Install it from PyPI
```bash
pip install xtlsapi
```
## Usage
```py
from xtlsapi import XrayClient, utils, exceptions
xray_client = XrayClient('1.2.3.4', 1234)
user_id = utils.generate_random_user_id()
user_email = utils.generate_random_email()
inbound_tag = 'inbound-tag'
# Get stats
print(utils.human_readable_bytes(xray_client.get_client_download_traffic('user-email@mail.com')))
print(utils.human_readable_bytes(xray_client.get_client_upload_traffic('user-email@mail.com')))
print(utils.human_readable_bytes(xray_client.get_inbound_download_traffic(inbound_tag)))
print(utils.human_readable_bytes(xray_client.get_inbound_upload_traffic(inbound_tag)))
# Add & Remove client
user = xray_client.add_client(inbound_tag, user_id, user_email)
if user:
print(user)
xray_client.remove_client(inbound_tag, user_email)
# restart logger
xray_client.restart_logger()
```
## Development
Read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
Raw data
{
"_id": null,
"home_page": "https://github.com/hiddify/xtlsapi/",
"name": "xtlsapi",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "hiddify",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1f/dd/abf6a9893b2da0af1df0340fa9da591ecc1af3bb3ad422ccfea9973340ce/xtlsapi-3.3.0.tar.gz",
"platform": null,
"description": "# xtlsapi\n\n[![codecov](https://codecov.io/gh/hiddify/xtlsapi/branch/main/graph/badge.svg?token=xtlsapi_token_here)](https://codecov.io/gh/hiddify/xtlsapi)\n[![CI](https://github.com/hiddify/xtlsapi/actions/workflows/main.yml/badge.svg)](https://github.com/hiddify/xtlsapi/actions/workflows/main.yml)\n\n\nPython library to communicate with xray core\n\n## Install it from PyPI\n\n```bash\npip install xtlsapi\n```\n\n## Usage\n\n```py\nfrom xtlsapi import XrayClient, utils, exceptions\n\nxray_client = XrayClient('1.2.3.4', 1234)\nuser_id = utils.generate_random_user_id()\nuser_email = utils.generate_random_email()\ninbound_tag = 'inbound-tag'\n\n# Get stats\nprint(utils.human_readable_bytes(xray_client.get_client_download_traffic('user-email@mail.com')))\nprint(utils.human_readable_bytes(xray_client.get_client_upload_traffic('user-email@mail.com')))\nprint(utils.human_readable_bytes(xray_client.get_inbound_download_traffic(inbound_tag)))\nprint(utils.human_readable_bytes(xray_client.get_inbound_upload_traffic(inbound_tag)))\n\n# Add & Remove client\nuser = xray_client.add_client(inbound_tag, user_id, user_email)\nif user:\n print(user)\n xray_client.remove_client(inbound_tag, user_email)\n\n# restart logger\nxray_client.restart_logger()\n```\n\n## Development\n\nRead the [CONTRIBUTING.md](CONTRIBUTING.md) file.\n",
"bugtrack_url": null,
"license": null,
"summary": "Awesome xtlsapi created by hiddify",
"version": "3.3.0",
"project_urls": {
"Homepage": "https://github.com/hiddify/xtlsapi/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6b2f2a576ca72fe7519640b76794d1dc8b9c1d07e1ae827c9197b368e519b420",
"md5": "16de4f954c3575200a1aaffb45a7f951",
"sha256": "4380f7d610e411c207269cdbec9aea80a1364ec4f0d5febcec6ebcfc30f090eb"
},
"downloads": -1,
"filename": "xtlsapi-3.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "16de4f954c3575200a1aaffb45a7f951",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 159329,
"upload_time": "2024-11-16T19:16:00",
"upload_time_iso_8601": "2024-11-16T19:16:00.805412Z",
"url": "https://files.pythonhosted.org/packages/6b/2f/2a576ca72fe7519640b76794d1dc8b9c1d07e1ae827c9197b368e519b420/xtlsapi-3.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1fddabf6a9893b2da0af1df0340fa9da591ecc1af3bb3ad422ccfea9973340ce",
"md5": "2afbde383a1e0cec79d20e7d0d9349a9",
"sha256": "a7ac3a6290808353b424d95f0a6a703e405920eca030345f9ba8dfcb82d2e2b8"
},
"downloads": -1,
"filename": "xtlsapi-3.3.0.tar.gz",
"has_sig": false,
"md5_digest": "2afbde383a1e0cec79d20e7d0d9349a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 52141,
"upload_time": "2024-11-16T19:16:02",
"upload_time_iso_8601": "2024-11-16T19:16:02.676407Z",
"url": "https://files.pythonhosted.org/packages/1f/dd/abf6a9893b2da0af1df0340fa9da591ecc1af3bb3ad422ccfea9973340ce/xtlsapi-3.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-16 19:16:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hiddify",
"github_project": "xtlsapi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "xtlsapi"
}