Skip to main content

A project that can create a VPN server(Vmess , Vless) using this script from X-UI panels

Project description

<h1>V2Ray Python API</h1>
<p>This is a Python API for V2Ray that allows users to create and delete V2Ray accounts programmatically. It provides an easy-to-use interface that allows developers to automate the process of creating and deleting accounts.</p>
<p>[Github-flavored Markdown](https://guides.github.com/features/mastering-markdown/)</p>
<h2>Requirements</h2>
<ul>
    <li>Python 3.x</li>
    <li><code>requests</code> module</li>
</ul>
<h2>Usage</h2>
<h3>Creating an account</h3>
<p>To create a new V2Ray account, instantiate the <code>V2Ray</code> class and call the <code>create_account</code> method with the following parameters:</p>
<ul>
    <li><code>protocol</code>: string, must be either <code>'vmess'</code> or <code>'vless'</code></li>
    <li><code>remark</code>: string, the name of the account</li>
    <li><code>total</code>: integer, the total amount of data that the account is allowed to use (in GB)</li>
    <li><code>expire</code>: integer, the number of days until the account expires</li>
    <li><code>port</code>: integer (optional), the port number to use for incoming connections (default is a random port between 11111 and 55555)</li>
    <li><code>alert_id</code>: integer (optional), the alert ID to use for the account (default is 1)</li>
</ul>
<pre><code>from v2ray import V2Ray

v2ray = V2Ray('localhost', '8080', 'session_token')

result = v2ray.create_account('vmess', 'My V2Ray Account', 10, 30) if result: print(result) else: print('Failed to create account')

Deleting an account

To delete a V2Ray account, call the delete_account method with one of the following parameters:

  • by: string, the name of the account to delete
from v2ray import V2Ray

v2ray = V2Ray('localhost', '8080', 'session_token')

result = v2ray.delete_account('My V2Ray Account') if result: print(result) else: print('Failed to delete account')

License

This code is licensed under the MIT License. Feel free to use it in your own projects or modify it to suit your needs.

Wrote By

Wrote by @Santrich

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

V2Ray-1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

V2Ray-1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file V2Ray-1.1.tar.gz.

File metadata

  • Download URL: V2Ray-1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for V2Ray-1.1.tar.gz
Algorithm Hash digest
SHA256 40563ec53432509a2530639e7534902b4a188303562aa3247f866fb74266d6da
MD5 9fc42dddae23c5c8a23c1740146c8a9b
BLAKE2b-256 1e2539de7e90f8289bc0d8e072de668d57c1ca7bb3cf3f62a9781f10e92126a0

See more details on using hashes here.

File details

Details for the file V2Ray-1.1-py3-none-any.whl.

File metadata

  • Download URL: V2Ray-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for V2Ray-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ffee4ef7ff02e13368a97a1ced60fcb61e130517bdbb236ba40789fe60da91b
MD5 c431ef9d7f88fdd25a0e172d8162f7fe
BLAKE2b-256 714a533a2cc5c399c62264a1a554715af13ee1bc6957ceca550ff6ccfebd9225

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page