tls-client


Nametls-client JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryAdvanced Python HTTP Client.
upload_time2024-02-02 18:55:55
maintainer
docs_urlNone
authorFlorian Zager
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python-TLS-Client

Python-TLS-Client is an advanced HTTP library based on requests and tls-client.



# Installation

```

pip install tls-client

```



# Examples

The syntax is inspired by [requests](https://github.com/psf/requests), so its very similar and there are only very few things that are different.



Example 1 - Preset:

```python

import tls_client



# You can also use the following as `client_identifier`:

# Chrome --> chrome_103, chrome_104, chrome_105, chrome_106, chrome_107, chrome_108, chrome109, Chrome110,

#            chrome111, chrome112, chrome_116_PSK, chrome_116_PSK_PQ, chrome_117, chrome_120

# Firefox --> firefox_102, firefox_104, firefox108, Firefox110, firefox_117, firefox_120

# Opera --> opera_89, opera_90

# Safari --> safari_15_3, safari_15_6_1, safari_16_0

# iOS --> safari_ios_15_5, safari_ios_15_6, safari_ios_16_0

# iPadOS --> safari_ios_15_6

# Android --> okhttp4_android_7, okhttp4_android_8, okhttp4_android_9, okhttp4_android_10, okhttp4_android_11,

#             okhttp4_android_12, okhttp4_android_13

#

# more client identifiers can be found in settings.py



session = tls_client.Session(

    client_identifier="chrome112",

    random_tls_extension_order=True

)



res = session.get(

    "https://www.example.com/",

    headers={

        "key1": "value1",

    },

    proxy="http://user:password@host:port"

)

```



Example 2 - Custom:

```python

import tls_client



session = tls_client.Session(

    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

    },

    h2_settings_order=[

        "HEADER_TABLE_SIZE",

        "MAX_CONCURRENT_STREAMS",

        "INITIAL_WINDOW_SIZE",

        "MAX_HEADER_LIST_SIZE"

    ],

    supported_signature_algorithms=[

        "ECDSAWithP256AndSHA256",

        "PSSWithSHA256",

        "PKCS1WithSHA256",

        "ECDSAWithP384AndSHA384",

        "PSSWithSHA384",

        "PKCS1WithSHA384",

        "PSSWithSHA512",

        "PKCS1WithSHA512",

    ],

    supported_versions=["GREASE", "1.3", "1.2"],

    key_share_curves=["GREASE", "X25519"],

    cert_compression_algo="brotli",

    pseudo_header_order=[

        ":method",

        ":authority",

        ":scheme",

        ":path"

    ],

    connection_flow=15663105,

    header_order=[

        "accept",

        "user-agent",

        "accept-encoding",

        "accept-language"

    ]

)



res = session.post(

    "https://www.example.com/",

    headers={

        "key1": "value1",

    },

    json={

        "key1": "key2"

    }

)

```



# Pyinstaller / Pyarmor

**If you want to pack the library with Pyinstaller or Pyarmor, make sure to add this to your command:**



Linux - Ubuntu / x86:

```

--add-binary '{path_to_library}/tls_client/dependencies/tls-client-x86.so:tls_client/dependencies'

```



Linux Alpine / AMD64:

```

--add-binary '{path_to_library}/tls_client/dependencies/tls-client-amd64.so:tls_client/dependencies'

```



MacOS M1 and older:

```

--add-binary '{path_to_library}/tls_client/dependencies/tls-client-x86.dylib:tls_client/dependencies'

```



MacOS M2:

```

--add-binary '{path_to_library}/tls_client/dependencies/tls-client-arm64.dylib:tls_client/dependencies'

```



Windows:

```

--add-binary '{path_to_library}/tls_client/dependencies/tls-client-64.dll;tls_client/dependencies'

```



# Acknowledgements

Big shout out to [Bogdanfinn](https://github.com/bogdanfinn) for open sourcing his [tls-client](https://github.com/bogdanfinn/tls-client) in Golang.

Also I wanted to keep the syntax as similar as possible to [requests](https://github.com/psf/requests), as most people use it and are familiar with it!




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "tls-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Florian Zager",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/3c/a6/6ec27c66a836a11a085e841f825d2f5bd289092f3bcd2f645558f587c89f/tls_client-1.0.1.tar.gz",
    "platform": null,
    "description": "# Python-TLS-Client\n\nPython-TLS-Client is an advanced HTTP library based on requests and tls-client.\n\n\n\n# Installation\n\n```\n\npip install tls-client\n\n```\n\n\n\n# Examples\n\nThe syntax is inspired by [requests](https://github.com/psf/requests), so its very similar and there are only very few things that are different.\n\n\n\nExample 1 - Preset:\n\n```python\n\nimport tls_client\n\n\n\n# You can also use the following as `client_identifier`:\n\n# Chrome --> chrome_103, chrome_104, chrome_105, chrome_106, chrome_107, chrome_108, chrome109, Chrome110,\n\n#            chrome111, chrome112, chrome_116_PSK, chrome_116_PSK_PQ, chrome_117, chrome_120\n\n# Firefox --> firefox_102, firefox_104, firefox108, Firefox110, firefox_117, firefox_120\n\n# Opera --> opera_89, opera_90\n\n# Safari --> safari_15_3, safari_15_6_1, safari_16_0\n\n# iOS --> safari_ios_15_5, safari_ios_15_6, safari_ios_16_0\n\n# iPadOS --> safari_ios_15_6\n\n# Android --> okhttp4_android_7, okhttp4_android_8, okhttp4_android_9, okhttp4_android_10, okhttp4_android_11,\n\n#             okhttp4_android_12, okhttp4_android_13\n\n#\n\n# more client identifiers can be found in settings.py\n\n\n\nsession = tls_client.Session(\n\n    client_identifier=\"chrome112\",\n\n    random_tls_extension_order=True\n\n)\n\n\n\nres = session.get(\n\n    \"https://www.example.com/\",\n\n    headers={\n\n        \"key1\": \"value1\",\n\n    },\n\n    proxy=\"http://user:password@host:port\"\n\n)\n\n```\n\n\n\nExample 2 - Custom:\n\n```python\n\nimport tls_client\n\n\n\nsession = tls_client.Session(\n\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\",\n\n    h2_settings={\n\n        \"HEADER_TABLE_SIZE\": 65536,\n\n        \"MAX_CONCURRENT_STREAMS\": 1000,\n\n        \"INITIAL_WINDOW_SIZE\": 6291456,\n\n        \"MAX_HEADER_LIST_SIZE\": 262144\n\n    },\n\n    h2_settings_order=[\n\n        \"HEADER_TABLE_SIZE\",\n\n        \"MAX_CONCURRENT_STREAMS\",\n\n        \"INITIAL_WINDOW_SIZE\",\n\n        \"MAX_HEADER_LIST_SIZE\"\n\n    ],\n\n    supported_signature_algorithms=[\n\n        \"ECDSAWithP256AndSHA256\",\n\n        \"PSSWithSHA256\",\n\n        \"PKCS1WithSHA256\",\n\n        \"ECDSAWithP384AndSHA384\",\n\n        \"PSSWithSHA384\",\n\n        \"PKCS1WithSHA384\",\n\n        \"PSSWithSHA512\",\n\n        \"PKCS1WithSHA512\",\n\n    ],\n\n    supported_versions=[\"GREASE\", \"1.3\", \"1.2\"],\n\n    key_share_curves=[\"GREASE\", \"X25519\"],\n\n    cert_compression_algo=\"brotli\",\n\n    pseudo_header_order=[\n\n        \":method\",\n\n        \":authority\",\n\n        \":scheme\",\n\n        \":path\"\n\n    ],\n\n    connection_flow=15663105,\n\n    header_order=[\n\n        \"accept\",\n\n        \"user-agent\",\n\n        \"accept-encoding\",\n\n        \"accept-language\"\n\n    ]\n\n)\n\n\n\nres = session.post(\n\n    \"https://www.example.com/\",\n\n    headers={\n\n        \"key1\": \"value1\",\n\n    },\n\n    json={\n\n        \"key1\": \"key2\"\n\n    }\n\n)\n\n```\n\n\n\n# Pyinstaller / Pyarmor\n\n**If you want to pack the library with Pyinstaller or Pyarmor, make sure to add this to your command:**\n\n\n\nLinux - Ubuntu / x86:\n\n```\n\n--add-binary '{path_to_library}/tls_client/dependencies/tls-client-x86.so:tls_client/dependencies'\n\n```\n\n\n\nLinux Alpine / AMD64:\n\n```\n\n--add-binary '{path_to_library}/tls_client/dependencies/tls-client-amd64.so:tls_client/dependencies'\n\n```\n\n\n\nMacOS M1 and older:\n\n```\n\n--add-binary '{path_to_library}/tls_client/dependencies/tls-client-x86.dylib:tls_client/dependencies'\n\n```\n\n\n\nMacOS M2:\n\n```\n\n--add-binary '{path_to_library}/tls_client/dependencies/tls-client-arm64.dylib:tls_client/dependencies'\n\n```\n\n\n\nWindows:\n\n```\n\n--add-binary '{path_to_library}/tls_client/dependencies/tls-client-64.dll;tls_client/dependencies'\n\n```\n\n\n\n# Acknowledgements\n\nBig shout out to [Bogdanfinn](https://github.com/bogdanfinn) for open sourcing his [tls-client](https://github.com/bogdanfinn/tls-client) in Golang.\n\nAlso I wanted to keep the syntax as similar as possible to [requests](https://github.com/psf/requests), as most people use it and are familiar with it!\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Advanced Python HTTP Client.",
    "version": "1.0.1",
    "project_urls": {
        "Source": "https://github.com/FlorianREGAZ/Python-Tls-Client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75cd5c735818692927e07980357445569adb6ee204c3332d19c516bae01c6cfa",
                "md5": "540768329e3b66c2c500321743c60705",
                "sha256": "2f8915c0642c2226c9e33120072a2af082812f6310d32f4ea4da322db7d3bb1c"
            },
            "downloads": -1,
            "filename": "tls_client-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "540768329e3b66c2c500321743c60705",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 41287556,
            "upload_time": "2024-02-02T18:55:52",
            "upload_time_iso_8601": "2024-02-02T18:55:52.226941Z",
            "url": "https://files.pythonhosted.org/packages/75/cd/5c735818692927e07980357445569adb6ee204c3332d19c516bae01c6cfa/tls_client-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3ca66ec27c66a836a11a085e841f825d2f5bd289092f3bcd2f645558f587c89f",
                "md5": "a18b12f636b3ce0ccde82fefaffedf3a",
                "sha256": "dad797f3412bb713606e0765d489f547ffb580c5ffdb74aed47a183ce8505ff5"
            },
            "downloads": -1,
            "filename": "tls_client-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a18b12f636b3ce0ccde82fefaffedf3a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16414,
            "upload_time": "2024-02-02T18:55:55",
            "upload_time_iso_8601": "2024-02-02T18:55:55.767554Z",
            "url": "https://files.pythonhosted.org/packages/3c/a6/6ec27c66a836a11a085e841f825d2f5bd289092f3bcd2f645558f587c89f/tls_client-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-02 18:55:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "FlorianREGAZ",
    "github_project": "Python-Tls-Client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "typing-extensions",
            "specs": []
        }
    ],
    "lcname": "tls-client"
}
        
Elapsed time: 0.33843s