Package: glizzy-tls
Glizzy TLSGlizzy TLS is a Python module that brings the power and flexibility of Go's TLS implementation to Python. It's designed to offer TLS (Transport Layer Security) capabilities in Python while taking advantage of the performance benefits of Go.Table of ContentsGlizzy TLSTable of ContentsDisclaimerWhat is TLS?Why Glizzy TLS?How is it done?InstallationExample UsageSession ObjectsCustom Client HelloSupported Parameters forSessionSupported Parameters forrequestContributingLicenseContact MeDisclaimerThis is a first implementation of TLS in python for non supported platforms from other modules. I've quickly done it for a project I'm working on. I'll improve it by adding more features as soon as I can.Check out thesource code on GitHubWhat is TLS?Transport Layer Security (TLS) is a protocol that provides privacy and data integrity between two communicating applications. It's used for web browsers and other applications that require data to be securely exchanged over a network.Why Glizzy TLS?While there are existing Python libraries for TLS, they can sometimes fall short in terms of performance and compatibility. Go has a robust and performant TLS library, and by compiling Go code to a shared object (.so) file and interfacing with it using CPython'sctypeslibrary, Glizzy TLS brings this power to Python.Moreover, the following key points make Glizzy TLS stand out:Platform Independence: Unlike other libraries that come with pre-compiled.sofiles, Glizzy TLS compiles the Go source code during installation. This means it can be used on any operating system without any modifications.Open Source and Customizable: The Go source code for the.sofile is publicly available. This means you can make any edits or customizations that you need for your specific use case.Shared Memory: Glizzy TLS uses shared memory to communicate between Python and Go. This means that the data is not copied between the two languages, which can lead to significant performance improvements.Shared cookies in Session Objects: Session objects can be used to share cookies between requests. This is useful for applications that require authentication.How is it done?The core of Glizzy TLS is the Go TLS implementation, which is compiled to a.sofile during installation. This file is then loaded and interfaced with in Python using thectypeslibrary. This allows Python code to call the Go functions directly, offering a seamless integration between the two languages.InstallationYou can install Glizzy TLS with pip:pipinstallglizzy-tlsPlease note that Glizzy TLS requires Go to be installed on your system. You can download it fromhere.Example UsageGlizzy TLS is designed to be as simple as possible and follows the same structure as Python'srequestslibrary. Here's an example of a simple HTTPS request:importglizzy_tlsresponse=glizzy_tls.get("https://example.com")print(response.status_code)print(response.text)Session Objectsfromglizzy_tlsimportSession# Create a TLS sessionsession=Session()response=session.get("https://tls.peet.ws/api/all")print(response.json()['tls']['ja3'])Custom Client Hellofromglizzy_tlsimportSession# Create a TLS sessionsession=Session(client_hello="chrome_112")response=session.get("https://tls.peet.ws/api/all")# Print the responseprint(response.json()['tls']['ja3'])See theexamplesdirectory for more examples.Supported Parameters forSessionclient_hello: The client hello to use. Defaults tochrome_112.Supported Parameters forrequestmethod: The HTTP method to use. Defaults toGET.url: The URL to request.headers: A dictionary of headers to send with the request.body: The body of the request.cookies: A dictionary of cookies to send with the request.proxy: The proxy to use. Defaults toNone.follow_redirects: Whether to follow redirects. Defaults toTrue.timeout_seconds: The timeout in seconds. Defaults to10.details: Whether to return detailed information about the request. Defaults toFalse. Will return aRequestDetailsobject instead of aResponseobject.ContributingContributions are welcome! Please seeCONTRIBUTING.mdfor more information.LicenseGlizzy TLS is licensed under theMIT License.Contact MeIf you have any questions, issues or just want to connect, feel free to reach out or follow me on these platforms:GitHubTwitterMediumMail