async-tls-client


Nameasync-tls-client JSON
Version 2.0.3 PyPI version JSON
download
home_pageNone
SummaryAsyncio TLS client with advanced fingerprinting capabilities
upload_time2025-11-06 20:35:01
maintainerNone
docs_urlNone
authorDiprog, Florian Zager
requires_python>=3.9
licenseMIT License Copyright (c) 2022 Florian Zager Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords tls asyncio http-client ja3 fingerprinting http2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python-TLS-Client-Async

[![PyPI version](https://img.shields.io/pypi/v/async_tls_client.svg)](https://pypi.org/project/async_tls_client/)
[![Python versions](https://img.shields.io/pypi/pyversions/async_tls_client.svg)](https://pypi.org/project/async_tls_client/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Asyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern fork
of [Python-TLS-Client](https://github.com/FlorianREGAZ/Python-Tls-Client) with enhanced features and active maintenance.

```python
from async_tls_client import AsyncClient
import asyncio


async def main():
    async with AsyncClient(
            client_identifier="chrome120",
            random_tls_extension_order=True
    ) as client:
        response = await client.get("https://tls.peet.ws/api/all")
        print(f"Detected TLS fingerprint: {response.json()['tls']['ja3_hash']}")


asyncio.run(main())
```

## Features ✨

- **Full Async Support**: Built with asyncio for high-performance concurrent requests
- **Modern TLS Fingerprinting**: JA3, JA4, HTTP/2 fingerprints and TLS 1.3 support
- **Client Profiles**: 50+ preconfigured clients (Chrome, Firefox, Safari, iOS, Android)
- **Advanced Configuration**:
    - Custom TLS cipher suites & extensions
    - HTTP/2 and QUIC protocol support
    - Certificate pinning and compression
    - Proxy support (HTTP/S, SOCKS4/5)
- **Auto-Cookie Management**: Session persistence with configurable cookie jars
- **Request Manipulation**: Header ordering, pseudo-header customization, and priority control

## Why This Fork? 🚀

The fork was created due to the lack of updates in the original repository, while the underlying GoLang
library [tls-client](https://github.com/bogdanfinn/tls-client) continues to evolve actively. This project aims to keep
up with the latest developments in the GoLang library and provide a modern, asynchronous interface for Python users.

### Recommendations:

- Monitor changelogs for deprecation warnings in future minor releases
- Avoid direct reliance on internal modules like `async_tls_client.structures` or `async_tls_client.cookies`
- Consider contributing feedback on the proposed changes through GitHub issues

## Installation 📦

```bash
pip install async_tls_client
```

## Quickstart 🚀

### Basic Usage

```python
from async_tls_client import AsyncClient
import asyncio


async def main():
    async with AsyncClient("chrome120") as client:
        response = await client.get(
            "https://httpbin.org/json",
            headers={"X-API-Key": "secret"},
            proxy="http://user:pass@proxy:port"
        )
        print(f"Status: {response.status_code}")
        print(f"Headers: {response.headers}")
        print(f"JSON: {response.json()}")


asyncio.run(main())
```

### Advanced Configuration

```python
from async_tls_client import AsyncClient

client = AsyncClient(
    ja3_string="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0",
    h2_settings={
        "HEADER_TABLE_SIZE": 65536,
        "MAX_CONCURRENT_STREAMS": 1000,
        "INITIAL_WINDOW_SIZE": 6291456,
        "MAX_HEADER_LIST_SIZE": 262144
    },
    supported_signature_algorithms=[
        "ECDSAWithP256AndSHA256",
        "PSSWithSHA256",
        "PKCS1WithSHA256",
        "ECDSAWithP384AndSHA384",
        "PSSWithSHA384",
        "PKCS1WithSHA512",
    ],
    certificate_pinning={
        "example.com": [
            "sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        ]
    }
)
```

## Client Profiles 🕶️

Preconfigured client identifiers (https://github.com/bogdanfinn/tls-client/blob/master/profiles/profiles.go):

| Browser/Framework | Available Profiles                                                                          |
|-------------------|---------------------------------------------------------------------------------------------|
| Chrome            | chrome_103 - chrome_133 (including PSK variants: 116_PSK, 116_PSK_PQ, 131_PSK, 133_PSK)     |
| Firefox           | firefox_102 - firefox_135                                                                   |
| Safari (Desktop)  | safari_15_6_1, safari_16_0, safari_ipad_15_6                                                |
| Safari (iOS)      | safari_ios_15_5 - safari_ios_18_0                                                           |
| Opera             | opera_89 - opera_91                                                                         |
| Android (OkHttp)  | okhttp4_android_7 - okhttp4_android_13                                                      |
| iOS (Custom)      | mms_ios (v1, v2, v3), mesh_ios (v1, v2), confirmed_ios, zalando_ios_mobile, nike_ios_mobile |
| Android (Custom)  | mesh_android (v1, v2), confirmed_android, zalando_android_mobile, nike_android_mobile       |
| Cloudflare        | cloudscraper                                                                                |

## Advanced Features 🔧

### Custom Fingerprint Configuration

```python
client = AsyncClient(
    ja3_string="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0",
    h2_settings_order=["HEADER_TABLE_SIZE", "MAX_CONCURRENT_STREAMS"],
    pseudo_header_order=[":method", ":authority", ":scheme", ":path"],
    header_order=["accept", "user-agent", "accept-encoding"],
    force_http1=False,
    cert_compression_algo="brotli"
)
```

### Certificate Pinning

```python
client = AsyncClient(
    certificate_pinning={
        "api.bank.com": [
            "sha256/7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=",
            "sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="
        ]
    }
)
```

### Proxy Support

```python
response = await client.get(
    "https://api.example.com",
    proxy="socks5://user:pass@proxy:1080"
)
```

## Asynchronous Design 🚧

The client leverages Python's asyncio through three key strategies:

1. **Non-blocking I/O**
    - Network operations run in separate threads using `asyncio.to_thread`
    - Go TLS client handles remain managed in background executors

2. **Session Management**
    - `AsyncClient` context manager handles automatic cleanup
    - Connection pooling with automatic keep-alives
    - Cookie persistence across requests

3. **Resource Optimization**
    - Zero-copy body handling for large responses
    - Lazy initialization of heavy resources
    - Automatic memory cleanup of Go pointers

## Packaging 📦

When using PyInstaller/PyArmor, include the shared library:

### Windows

```bash
--add-binary 'async_tls_client/dependencies/tls-client-64.dll;async_tls_client/dependencies'
```

### Linux

```bash
--add-binary 'async_tls_client/dependencies/tls-client-x86.so:async_tls_client/dependencies'
```

### macOS

```bash
--add-binary 'async_tls_client/dependencies/tls-client-arm64.dylib:async_tls_client/dependencies'
```

## Acknowledgements 🙏

- Original Python implementation: [FlorianREGAZ/Python-Tls-Client](https://github.com/FlorianREGAZ/Python-Tls-Client)
- Core TLS implementation: [bogdanfinn/tls-client](https://github.com/bogdanfinn/tls-client)
- Inspiration: [psf/requests](https://github.com/psf/requests)

## License 📄

MIT License - See [LICENSE](LICENSE) for details

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "async-tls-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "tls, asyncio, http-client, ja3, fingerprinting, http2",
    "author": "Diprog, Florian Zager",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/53/8f/dbc319d220521eaed9b58101d97e51d53f3f62d516c82288fbcd9011b222/async_tls_client-2.0.3.tar.gz",
    "platform": null,
    "description": "# Python-TLS-Client-Async\r\n\r\n[![PyPI version](https://img.shields.io/pypi/v/async_tls_client.svg)](https://pypi.org/project/async_tls_client/)\r\n[![Python versions](https://img.shields.io/pypi/pyversions/async_tls_client.svg)](https://pypi.org/project/async_tls_client/)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\r\n\r\nAsyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern fork\r\nof [Python-TLS-Client](https://github.com/FlorianREGAZ/Python-Tls-Client) with enhanced features and active maintenance.\r\n\r\n```python\r\nfrom async_tls_client import AsyncClient\r\nimport asyncio\r\n\r\n\r\nasync def main():\r\n    async with AsyncClient(\r\n            client_identifier=\"chrome120\",\r\n            random_tls_extension_order=True\r\n    ) as client:\r\n        response = await client.get(\"https://tls.peet.ws/api/all\")\r\n        print(f\"Detected TLS fingerprint: {response.json()['tls']['ja3_hash']}\")\r\n\r\n\r\nasyncio.run(main())\r\n```\r\n\r\n## Features \u2728\r\n\r\n- **Full Async Support**: Built with asyncio for high-performance concurrent requests\r\n- **Modern TLS Fingerprinting**: JA3, JA4, HTTP/2 fingerprints and TLS 1.3 support\r\n- **Client Profiles**: 50+ preconfigured clients (Chrome, Firefox, Safari, iOS, Android)\r\n- **Advanced Configuration**:\r\n    - Custom TLS cipher suites & extensions\r\n    - HTTP/2 and QUIC protocol support\r\n    - Certificate pinning and compression\r\n    - Proxy support (HTTP/S, SOCKS4/5)\r\n- **Auto-Cookie Management**: Session persistence with configurable cookie jars\r\n- **Request Manipulation**: Header ordering, pseudo-header customization, and priority control\r\n\r\n## Why This Fork? \ud83d\ude80\r\n\r\nThe fork was created due to the lack of updates in the original repository, while the underlying GoLang\r\nlibrary [tls-client](https://github.com/bogdanfinn/tls-client) continues to evolve actively. This project aims to keep\r\nup with the latest developments in the GoLang library and provide a modern, asynchronous interface for Python users.\r\n\r\n### Recommendations:\r\n\r\n- Monitor changelogs for deprecation warnings in future minor releases\r\n- Avoid direct reliance on internal modules like `async_tls_client.structures` or `async_tls_client.cookies`\r\n- Consider contributing feedback on the proposed changes through GitHub issues\r\n\r\n## Installation \ud83d\udce6\r\n\r\n```bash\r\npip install async_tls_client\r\n```\r\n\r\n## Quickstart \ud83d\ude80\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom async_tls_client import AsyncClient\r\nimport asyncio\r\n\r\n\r\nasync def main():\r\n    async with AsyncClient(\"chrome120\") as client:\r\n        response = await client.get(\r\n            \"https://httpbin.org/json\",\r\n            headers={\"X-API-Key\": \"secret\"},\r\n            proxy=\"http://user:pass@proxy:port\"\r\n        )\r\n        print(f\"Status: {response.status_code}\")\r\n        print(f\"Headers: {response.headers}\")\r\n        print(f\"JSON: {response.json()}\")\r\n\r\n\r\nasyncio.run(main())\r\n```\r\n\r\n### Advanced Configuration\r\n\r\n```python\r\nfrom async_tls_client import AsyncClient\r\n\r\nclient = AsyncClient(\r\n    ja3_string=\"771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0\",\r\n    h2_settings={\r\n        \"HEADER_TABLE_SIZE\": 65536,\r\n        \"MAX_CONCURRENT_STREAMS\": 1000,\r\n        \"INITIAL_WINDOW_SIZE\": 6291456,\r\n        \"MAX_HEADER_LIST_SIZE\": 262144\r\n    },\r\n    supported_signature_algorithms=[\r\n        \"ECDSAWithP256AndSHA256\",\r\n        \"PSSWithSHA256\",\r\n        \"PKCS1WithSHA256\",\r\n        \"ECDSAWithP384AndSHA384\",\r\n        \"PSSWithSHA384\",\r\n        \"PKCS1WithSHA512\",\r\n    ],\r\n    certificate_pinning={\r\n        \"example.com\": [\r\n            \"sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"\r\n        ]\r\n    }\r\n)\r\n```\r\n\r\n## Client Profiles \ud83d\udd76\ufe0f\r\n\r\nPreconfigured client identifiers (https://github.com/bogdanfinn/tls-client/blob/master/profiles/profiles.go):\r\n\r\n| Browser/Framework | Available Profiles                                                                          |\r\n|-------------------|---------------------------------------------------------------------------------------------|\r\n| Chrome            | chrome_103 - chrome_133 (including PSK variants: 116_PSK, 116_PSK_PQ, 131_PSK, 133_PSK)     |\r\n| Firefox           | firefox_102 - firefox_135                                                                   |\r\n| Safari (Desktop)  | safari_15_6_1, safari_16_0, safari_ipad_15_6                                                |\r\n| Safari (iOS)      | safari_ios_15_5 - safari_ios_18_0                                                           |\r\n| Opera             | opera_89 - opera_91                                                                         |\r\n| Android (OkHttp)  | okhttp4_android_7 - okhttp4_android_13                                                      |\r\n| iOS (Custom)      | mms_ios (v1, v2, v3), mesh_ios (v1, v2), confirmed_ios, zalando_ios_mobile, nike_ios_mobile |\r\n| Android (Custom)  | mesh_android (v1, v2), confirmed_android, zalando_android_mobile, nike_android_mobile       |\r\n| Cloudflare        | cloudscraper                                                                                |\r\n\r\n## Advanced Features \ud83d\udd27\r\n\r\n### Custom Fingerprint Configuration\r\n\r\n```python\r\nclient = AsyncClient(\r\n    ja3_string=\"771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0\",\r\n    h2_settings_order=[\"HEADER_TABLE_SIZE\", \"MAX_CONCURRENT_STREAMS\"],\r\n    pseudo_header_order=[\":method\", \":authority\", \":scheme\", \":path\"],\r\n    header_order=[\"accept\", \"user-agent\", \"accept-encoding\"],\r\n    force_http1=False,\r\n    cert_compression_algo=\"brotli\"\r\n)\r\n```\r\n\r\n### Certificate Pinning\r\n\r\n```python\r\nclient = AsyncClient(\r\n    certificate_pinning={\r\n        \"api.bank.com\": [\r\n            \"sha256/7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=\",\r\n            \"sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg=\"\r\n        ]\r\n    }\r\n)\r\n```\r\n\r\n### Proxy Support\r\n\r\n```python\r\nresponse = await client.get(\r\n    \"https://api.example.com\",\r\n    proxy=\"socks5://user:pass@proxy:1080\"\r\n)\r\n```\r\n\r\n## Asynchronous Design \ud83d\udea7\r\n\r\nThe client leverages Python's asyncio through three key strategies:\r\n\r\n1. **Non-blocking I/O**\r\n    - Network operations run in separate threads using `asyncio.to_thread`\r\n    - Go TLS client handles remain managed in background executors\r\n\r\n2. **Session Management**\r\n    - `AsyncClient` context manager handles automatic cleanup\r\n    - Connection pooling with automatic keep-alives\r\n    - Cookie persistence across requests\r\n\r\n3. **Resource Optimization**\r\n    - Zero-copy body handling for large responses\r\n    - Lazy initialization of heavy resources\r\n    - Automatic memory cleanup of Go pointers\r\n\r\n## Packaging \ud83d\udce6\r\n\r\nWhen using PyInstaller/PyArmor, include the shared library:\r\n\r\n### Windows\r\n\r\n```bash\r\n--add-binary 'async_tls_client/dependencies/tls-client-64.dll;async_tls_client/dependencies'\r\n```\r\n\r\n### Linux\r\n\r\n```bash\r\n--add-binary 'async_tls_client/dependencies/tls-client-x86.so:async_tls_client/dependencies'\r\n```\r\n\r\n### macOS\r\n\r\n```bash\r\n--add-binary 'async_tls_client/dependencies/tls-client-arm64.dylib:async_tls_client/dependencies'\r\n```\r\n\r\n## Acknowledgements \ud83d\ude4f\r\n\r\n- Original Python implementation: [FlorianREGAZ/Python-Tls-Client](https://github.com/FlorianREGAZ/Python-Tls-Client)\r\n- Core TLS implementation: [bogdanfinn/tls-client](https://github.com/bogdanfinn/tls-client)\r\n- Inspiration: [psf/requests](https://github.com/psf/requests)\r\n\r\n## License \ud83d\udcc4\r\n\r\nMIT License - See [LICENSE](LICENSE) for details\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2022 Florian Zager\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.\r\n        ",
    "summary": "Asyncio TLS client with advanced fingerprinting capabilities",
    "version": "2.0.3",
    "project_urls": {
        "Changelog": "https://github.com/diprog/python-tls-client-async/releases",
        "Documentation": "https://github.com/diprog/python-tls-client-async#readme",
        "Homepage": "https://github.com/diprog/python-tls-client-async",
        "Issues": "https://github.com/diprog/python-tls-client-async/issues",
        "Original": "https://github.com/FlorianREGAZ/Python-Tls-Client"
    },
    "split_keywords": [
        "tls",
        " asyncio",
        " http-client",
        " ja3",
        " fingerprinting",
        " http2"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fd9ae60ea3de88e415dd0e54c9f981f009ae643c0ecda9d08fd8f747c7d2e7c7",
                "md5": "d49abd764c0090981656e94b956ddb89",
                "sha256": "c7587f17f9a24611760cfe6d29d094140af227e853376036c023170ae1f3b0bb"
            },
            "downloads": -1,
            "filename": "async_tls_client-2.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d49abd764c0090981656e94b956ddb89",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 46437382,
            "upload_time": "2025-11-06T20:34:03",
            "upload_time_iso_8601": "2025-11-06T20:34:03.616246Z",
            "url": "https://files.pythonhosted.org/packages/fd/9a/e60ea3de88e415dd0e54c9f981f009ae643c0ecda9d08fd8f747c7d2e7c7/async_tls_client-2.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "538fdbc319d220521eaed9b58101d97e51d53f3f62d516c82288fbcd9011b222",
                "md5": "6f3d3fdf34e702bc99e91c03b79cb9a9",
                "sha256": "c57f4c50a66aca7e666139371b4f3ad096b484fbae5edec95025c9bc55f06351"
            },
            "downloads": -1,
            "filename": "async_tls_client-2.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6f3d3fdf34e702bc99e91c03b79cb9a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 46199162,
            "upload_time": "2025-11-06T20:35:01",
            "upload_time_iso_8601": "2025-11-06T20:35:01.077207Z",
            "url": "https://files.pythonhosted.org/packages/53/8f/dbc319d220521eaed9b58101d97e51d53f3f62d516c82288fbcd9011b222/async_tls_client-2.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-06 20:35:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "diprog",
    "github_project": "python-tls-client-async",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "async-tls-client"
}
        
Elapsed time: 3.60066s