Skip to main content

Advanced Python HTTP Client.

Project description

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 insprired from requests, so its very similar and their are only very few things that are different.

Example 1 - Preset:

import tls_client



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

# Chrome --> chrome_103, chrome_104, chrome_105

# Firefox --> firefox_102, firefox_104

# 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



session = tls_client.Session(

    client_identifier="chrome_105"

)



res = session.get(

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

    headers={

        "key1": "value1",

    },

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

)

Example 2 - Custom:

import tls_client



# You can find more details about the arguments in `session.py` e.g. what 1, 2, 3, 4 etc. represents in h2_settings

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={

      1: 65536,

      3: 1000,

      4: 6291456,

      6: 262144

    },

    h2_settings_order=[

        1,

        3,

        4,

        6

    ],

    pseudo_header_order=[

        ":method",

        ":authority",

        ":scheme",

        ":path"

    ],

    connection_flow=15663105

)



res = session.post(

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

    headers={

        "key1": "value1",

    },

    json={

        "key1": "key2"

    }

)

Acknowledgements

Big shout out to Bogdanfinn for open sourcing his tls-client in Golang.

Also to requests, as most of the cookie handling is copied from it. :'D


I wanted to keep the syntax as similar as possible to requests, as most people use it and are familiar with it!

Project details


Download files

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

Source Distribution

tls_client-0.0.3.tar.gz (14.6 MB view details)

Uploaded Source

Built Distribution

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

tls_client-0.0.3-py3-none-any.whl (14.7 MB view details)

Uploaded Python 3

File details

Details for the file tls_client-0.0.3.tar.gz.

File metadata

  • Download URL: tls_client-0.0.3.tar.gz
  • Upload date:
  • Size: 14.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.0

File hashes

Hashes for tls_client-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b58cc460bd729bc84f4eae2a8ee9bfc0cfc0f38a1fddfa613fb9d51193e33864
MD5 7af414e3dcc9f8ebc04bca1fc4244c08
BLAKE2b-256 0c4b71d5a1ad70a12a9713d51c2f216a7c25bc1c9a68c077d60af639c9980b55

See more details on using hashes here.

File details

Details for the file tls_client-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tls_client-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.0

File hashes

Hashes for tls_client-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41dc9478eb37f1a09df68a4c29d9b1221d2e8ce72fd054fdd3f7ad6747993f90
MD5 debeab46281a0f7e596b9a4b7e85de77
BLAKE2b-256 b41cd2565c043fa083d1a761bf3788303a02c8c8671f386abb408ce84b110cf5

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