singbox2proxy


Namesingbox2proxy JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
Summary🐳 Use sing-box proxies (VLESS, VMess, Trojan, Shadowsocks, Hysteria, Hysteria2, TUIC, WireGuard, SSH) with chaining support in python web clients.
upload_time2025-09-10 10:18:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords sing-box hysteria2 v2ray v2core v2ray-core proxy vless vmess shadowsocks trojan python cli
VCS
bugtrack_url
requirements psutil
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## singbox2proxy

Integrate sing-box proxies into your python applications with ease.

singbox2proxy is basically a fork of [v2ray2proxy](https://github.com/nichind/v2ray2proxy) with enhanced perfomance and protocol support using [sing-box](https://github.com/SagerNet/sing-box) instead of xray-core.

 [![Pip module installs total downloads](https://img.shields.io/pypi/dm/singbox2proxy.svg)](https://pypi.org/project/singbox2proxy/)[![Run Tests](https://github.com/nichind/singbox2proxy/actions/workflows/build.yml/badge.svg)](https://github.com/nichind/singbox2proxy/actions/workflows/build.yml) [![Upload Python Package to PyPI when a Release is Created](https://github.com/nichind/singbox2proxy/actions/workflows/publish.yml/badge.svg)](https://github.com/nichind/singbox2proxy/actions/workflows/publish.yml)

### Installation

with pip

```shell
pip install singbox2proxy 
```

with [uv](https://pypi.org/project/uv/)

```shell
uv install singbox2proxy 
```

build from source

```shell
git clone https://github.com/nichind/singbox2proxy.git
cd singbox2proxy
pip install -e .
```

### Example usage

Using built-in [curl-cffi](https://pypi.org/project/curl-cffi/) or [requests](https://pypi.org/project/requests/) client

```python
from singbox2proxy import SingBoxProxy

proxy = SingBoxProxy("vless://...")
response = proxy.request("GET", "https://api.ipify.org?format=json")  # IF curl-cffi is installed, it will be used; otherwise, requests will be used.
print(response.status_code, response.text)  # 200, {"ip":"..."}
```

Integrating with your own HTTP client

```python
import requests
from singbox2proxy import SingBoxProxy

proxy = SingBoxProxy("hy2://...")
session = requests.Session()
session.proxies = proxy.proxy_for_requests  # {"http": "http://127.0.0.1:<port>", "https": "http://127.0.0.1:<port>"}
response = session.get("https://api.ipify.org?format=json")
print(response.status_code, response.text)  # 200, {"ip":"..."}
```

Example with aiohttp

```python
from singbox2proxy import SingBoxProxy
import aiohttp

async def main():
    proxy = SingBoxProxy("vmess://...")
    async with aiohttp.ClientSession(proxy=proxy.socks5_proxy_url or proxy.http_proxy_url) as session:
        async with session.get("https://api.ipify.org?format=json") as response:
            print(response.status, await response.text())  # 200, {"ip":"..."}
```

### Chaining

Chained proxies allow you to route your traffic through multiple proxy servers if you'll ever need more privacy or easy restriction bypass. You can chain multiple proxies together by specifying a `chain_proxy` with a gate `SingBoxProxy` instance when creating a new `SingBoxProxy`.

```python
from singbox2proxy import SingBoxProxy

proxy1 = SingBoxProxy("vmess://...")
proxy2 = SingBoxProxy("vless://...", chain_proxy=proxy1)

response = proxy2.request("GET", "https://api.ipify.org?format=json")
print(response.status_code, response.text)  # 200, {"ip": "<proxy2's IP>"}
# Here, requests made through `proxy2` will first go through `proxy1`, then proxy1 will forward the request to proxy2, and finally proxy2 will send the request to the target server.
```

### Discaimer

I'm not responsible for possible misuse of this software. Please use it in accordance with the law and respect the terms of service of the services you access through proxies.

#### Consider leaving a star ⭐

[![Star History Chart](https://api.star-history.com/svg?repos=nichind/singbox2proxy&type=Date)](https://github.com/nichind/singbox2proxy)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "singbox2proxy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "sing-box, hysteria2, v2ray, v2core, v2ray-core, proxy, vless, vmess, shadowsocks, trojan, python, cli",
    "author": null,
    "author_email": "nichind <nichind@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/f9/0c/50add01e750d6b00536db4cdb73cdeb6d2cba878ff8e94978e9fe66209f0/singbox2proxy-0.1.3.tar.gz",
    "platform": null,
    "description": "## singbox2proxy\n\nIntegrate sing-box proxies into your python applications with ease.\n\nsingbox2proxy is basically a fork of [v2ray2proxy](https://github.com/nichind/v2ray2proxy) with enhanced perfomance and protocol support using [sing-box](https://github.com/SagerNet/sing-box) instead of xray-core.\n\n [![Pip module installs total downloads](https://img.shields.io/pypi/dm/singbox2proxy.svg)](https://pypi.org/project/singbox2proxy/)[![Run Tests](https://github.com/nichind/singbox2proxy/actions/workflows/build.yml/badge.svg)](https://github.com/nichind/singbox2proxy/actions/workflows/build.yml) [![Upload Python Package to PyPI when a Release is Created](https://github.com/nichind/singbox2proxy/actions/workflows/publish.yml/badge.svg)](https://github.com/nichind/singbox2proxy/actions/workflows/publish.yml)\n\n### Installation\n\nwith pip\n\n```shell\npip install singbox2proxy \n```\n\nwith [uv](https://pypi.org/project/uv/)\n\n```shell\nuv install singbox2proxy \n```\n\nbuild from source\n\n```shell\ngit clone https://github.com/nichind/singbox2proxy.git\ncd singbox2proxy\npip install -e .\n```\n\n### Example usage\n\nUsing built-in [curl-cffi](https://pypi.org/project/curl-cffi/) or [requests](https://pypi.org/project/requests/) client\n\n```python\nfrom singbox2proxy import SingBoxProxy\n\nproxy = SingBoxProxy(\"vless://...\")\nresponse = proxy.request(\"GET\", \"https://api.ipify.org?format=json\")  # IF curl-cffi is installed, it will be used; otherwise, requests will be used.\nprint(response.status_code, response.text)  # 200, {\"ip\":\"...\"}\n```\n\nIntegrating with your own HTTP client\n\n```python\nimport requests\nfrom singbox2proxy import SingBoxProxy\n\nproxy = SingBoxProxy(\"hy2://...\")\nsession = requests.Session()\nsession.proxies = proxy.proxy_for_requests  # {\"http\": \"http://127.0.0.1:<port>\", \"https\": \"http://127.0.0.1:<port>\"}\nresponse = session.get(\"https://api.ipify.org?format=json\")\nprint(response.status_code, response.text)  # 200, {\"ip\":\"...\"}\n```\n\nExample with aiohttp\n\n```python\nfrom singbox2proxy import SingBoxProxy\nimport aiohttp\n\nasync def main():\n    proxy = SingBoxProxy(\"vmess://...\")\n    async with aiohttp.ClientSession(proxy=proxy.socks5_proxy_url or proxy.http_proxy_url) as session:\n        async with session.get(\"https://api.ipify.org?format=json\") as response:\n            print(response.status, await response.text())  # 200, {\"ip\":\"...\"}\n```\n\n### Chaining\n\nChained proxies allow you to route your traffic through multiple proxy servers if you'll ever need more privacy or easy restriction bypass. You can chain multiple proxies together by specifying a `chain_proxy` with a gate `SingBoxProxy` instance when creating a new `SingBoxProxy`.\n\n```python\nfrom singbox2proxy import SingBoxProxy\n\nproxy1 = SingBoxProxy(\"vmess://...\")\nproxy2 = SingBoxProxy(\"vless://...\", chain_proxy=proxy1)\n\nresponse = proxy2.request(\"GET\", \"https://api.ipify.org?format=json\")\nprint(response.status_code, response.text)  # 200, {\"ip\": \"<proxy2's IP>\"}\n# Here, requests made through `proxy2` will first go through `proxy1`, then proxy1 will forward the request to proxy2, and finally proxy2 will send the request to the target server.\n```\n\n### Discaimer\n\nI'm not responsible for possible misuse of this software. Please use it in accordance with the law and respect the terms of service of the services you access through proxies.\n\n#### Consider leaving a star \u2b50\n\n[![Star History Chart](https://api.star-history.com/svg?repos=nichind/singbox2proxy&type=Date)](https://github.com/nichind/singbox2proxy)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\udc33 Use sing-box proxies (VLESS, VMess, Trojan, Shadowsocks, Hysteria, Hysteria2, TUIC, WireGuard, SSH) with chaining support in python web clients.",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/nichind/sing-box2proxy",
        "Issues": "https://github.com/nichind/sing-box2proxy/issues"
    },
    "split_keywords": [
        "sing-box",
        " hysteria2",
        " v2ray",
        " v2core",
        " v2ray-core",
        " proxy",
        " vless",
        " vmess",
        " shadowsocks",
        " trojan",
        " python",
        " cli"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "efad789769e0cbea2f3c1a9b2f75c2a73463a3468c8f0690c6c14926feabbfdf",
                "md5": "dca77ae0b365f80a6f0ea85d948c5c83",
                "sha256": "bc748a21585a321148e2ae7e84c25f9f92eb63e62e638408df628bad9a606dcd"
            },
            "downloads": -1,
            "filename": "singbox2proxy-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dca77ae0b365f80a6f0ea85d948c5c83",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 18059,
            "upload_time": "2025-09-10T10:18:25",
            "upload_time_iso_8601": "2025-09-10T10:18:25.729432Z",
            "url": "https://files.pythonhosted.org/packages/ef/ad/789769e0cbea2f3c1a9b2f75c2a73463a3468c8f0690c6c14926feabbfdf/singbox2proxy-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f90c50add01e750d6b00536db4cdb73cdeb6d2cba878ff8e94978e9fe66209f0",
                "md5": "5ef4f1a0d7a6800cef68cd3426ce3f9c",
                "sha256": "3eefd9354938d8e6c4600305ed5164d142c54b0c14292d0fe4fb648330fa1d1b"
            },
            "downloads": -1,
            "filename": "singbox2proxy-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5ef4f1a0d7a6800cef68cd3426ce3f9c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 18632,
            "upload_time": "2025-09-10T10:18:26",
            "upload_time_iso_8601": "2025-09-10T10:18:26.886978Z",
            "url": "https://files.pythonhosted.org/packages/f9/0c/50add01e750d6b00536db4cdb73cdeb6d2cba878ff8e94978e9fe66209f0/singbox2proxy-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-10 10:18:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nichind",
    "github_project": "sing-box2proxy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "psutil",
            "specs": []
        }
    ],
    "lcname": "singbox2proxy"
}
        
Elapsed time: 2.61250s