cloudflare-client


Namecloudflare-client JSON
Version 2.4.5 PyPI version JSON
download
home_page
SummaryAdvanced Python HTTP client based on tls-client, able to bypass Cloudflare UAM
upload_time2024-02-07 05:01:40
maintainer
docs_urlNone
authorcloudflare-guy
requires_python>=3.10,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cloudflare-client
cloudflare-client is an advanced HTTP library based on requests and tls-client. It can be used to bypass JA3 fingerprinting and Cloudflare UAM.

# Installation
```
pip install cloudflare-client
```

# Examples
The syntax is inspired by [requests](https://github.com/psf/requests), there are very few things that are different.

Example 1 - Preset:
```python
import cloudflare_client

# You can also use the following as `browser`:
# 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 = cloudflare_client.Session(
    browser="chrome120",
    random_tls_extension_order=True,
    cloudflare_uam=True
)

res = session.get(
    "https://www.example.com/",
    headers={
        "key1": "value1",
    },
    proxy="http://user:password@host:port"
)
```

Example 2 - Custom:
```python
import cloudflare_client

session = cloudflare_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}/cloudflare_client/dependencies/cloudflare-client-x86.so:cloudflare_client/dependencies'
```

Linux Alpine / AMD64:
```
--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-amd64.so:cloudflare_client/dependencies'
```

MacOS M1 and older:
```
--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-x86.dylib:cloudflare_client/dependencies'
```

MacOS M2:
```
--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-arm64.dylib:cloudflare_client/dependencies'
```

Windows:
```
--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-64.dll;cloudflare_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": "cloudflare-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "cloudflare-guy",
    "author_email": "",
    "download_url": "",
    "platform": null,
    "description": "# cloudflare-client\ncloudflare-client is an advanced HTTP library based on requests and tls-client. It can be used to bypass JA3 fingerprinting and Cloudflare UAM.\n\n# Installation\n```\npip install cloudflare-client\n```\n\n# Examples\nThe syntax is inspired by [requests](https://github.com/psf/requests), there are very few things that are different.\n\nExample 1 - Preset:\n```python\nimport cloudflare_client\n\n# You can also use the following as `browser`:\n# Chrome --> chrome_103, chrome_104, chrome_105, chrome_106, chrome_107, chrome_108, chrome109, Chrome110,\n#            chrome111, chrome112, chrome_116_PSK, chrome_116_PSK_PQ, chrome_117, chrome_120\n# Firefox --> firefox_102, firefox_104, firefox108, Firefox110, firefox_117, firefox_120\n# Opera --> opera_89, opera_90\n# Safari --> safari_15_3, safari_15_6_1, safari_16_0\n# iOS --> safari_ios_15_5, safari_ios_15_6, safari_ios_16_0\n# iPadOS --> safari_ios_15_6\n# Android --> okhttp4_android_7, okhttp4_android_8, okhttp4_android_9, okhttp4_android_10, okhttp4_android_11,\n#             okhttp4_android_12, okhttp4_android_13\n#\n# more client identifiers can be found in settings.py\n\nsession = cloudflare_client.Session(\n    browser=\"chrome120\",\n    random_tls_extension_order=True,\n    cloudflare_uam=True\n)\n\nres = session.get(\n    \"https://www.example.com/\",\n    headers={\n        \"key1\": \"value1\",\n    },\n    proxy=\"http://user:password@host:port\"\n)\n```\n\nExample 2 - Custom:\n```python\nimport cloudflare_client\n\nsession = cloudflare_client.Session(\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    h2_settings={\n        \"HEADER_TABLE_SIZE\": 65536,\n        \"MAX_CONCURRENT_STREAMS\": 1000,\n        \"INITIAL_WINDOW_SIZE\": 6291456,\n        \"MAX_HEADER_LIST_SIZE\": 262144\n    },\n    h2_settings_order=[\n        \"HEADER_TABLE_SIZE\",\n        \"MAX_CONCURRENT_STREAMS\",\n        \"INITIAL_WINDOW_SIZE\",\n        \"MAX_HEADER_LIST_SIZE\"\n    ],\n    supported_signature_algorithms=[\n        \"ECDSAWithP256AndSHA256\",\n        \"PSSWithSHA256\",\n        \"PKCS1WithSHA256\",\n        \"ECDSAWithP384AndSHA384\",\n        \"PSSWithSHA384\",\n        \"PKCS1WithSHA384\",\n        \"PSSWithSHA512\",\n        \"PKCS1WithSHA512\",\n    ],\n    supported_versions=[\"GREASE\", \"1.3\", \"1.2\"],\n    key_share_curves=[\"GREASE\", \"X25519\"],\n    cert_compression_algo=\"brotli\",\n    pseudo_header_order=[\n        \":method\",\n        \":authority\",\n        \":scheme\",\n        \":path\"\n    ],\n    connection_flow=15663105,\n    header_order=[\n        \"accept\",\n        \"user-agent\",\n        \"accept-encoding\",\n        \"accept-language\"\n    ]\n)\n\nres = session.post(\n    \"https://www.example.com/\",\n    headers={\n        \"key1\": \"value1\",\n    },\n    json={\n        \"key1\": \"key2\"\n    }\n)\n```\n\n# Pyinstaller / Pyarmor\n**If you want to pack the library with Pyinstaller or Pyarmor, make sure to add this to your command:**\n\nLinux - Ubuntu / x86:\n```\n--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-x86.so:cloudflare_client/dependencies'\n```\n\nLinux Alpine / AMD64:\n```\n--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-amd64.so:cloudflare_client/dependencies'\n```\n\nMacOS M1 and older:\n```\n--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-x86.dylib:cloudflare_client/dependencies'\n```\n\nMacOS M2:\n```\n--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-arm64.dylib:cloudflare_client/dependencies'\n```\n\nWindows:\n```\n--add-binary '{path_to_library}/cloudflare_client/dependencies/cloudflare-client-64.dll;cloudflare_client/dependencies'\n```\n\n# Acknowledgements\nBig shout out to [Bogdanfinn](https://github.com/bogdanfinn) for open sourcing his [tls-client](https://github.com/bogdanfinn/tls-client) in Golang.\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",
    "bugtrack_url": null,
    "license": "",
    "summary": "Advanced Python HTTP client based on tls-client, able to bypass Cloudflare UAM",
    "version": "2.4.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a79b3c8f06fdc81762cde5a8cf898623fdfc06908953b4615de75163cd30fc3c",
                "md5": "7eff485ccd42219e05e324086f73573e",
                "sha256": "3b1956a137a9f9a0856c56d6fc7f007bd9b97573b69daf7dec554d60b7c49c5d"
            },
            "downloads": -1,
            "filename": "cloudflare_client-2.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7eff485ccd42219e05e324086f73573e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 2808,
            "upload_time": "2024-02-07T05:01:40",
            "upload_time_iso_8601": "2024-02-07T05:01:40.294959Z",
            "url": "https://files.pythonhosted.org/packages/a7/9b/3c8f06fdc81762cde5a8cf898623fdfc06908953b4615de75163cd30fc3c/cloudflare_client-2.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 05:01:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cloudflare-client"
}
        
Elapsed time: 0.17068s