ramikg / ssl-context-configurator Goto Github PK
View Code? Open in Web Editor NEWConfigure Python SSLContext objects in a hacky way
License: The Unlicense
Configure Python SSLContext objects in a hacky way
License: The Unlicense
Hi, can you provide more working examples because I used the example code from code page and got this error:
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "C:\Python38\lib\site-packages\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Python38\lib\site-packages\urllib3\util\ssl_.py", line 454, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "C:\Python38\lib\site-packages\urllib3\util\ssl_.py", line 498, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Python38\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Python38\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Python38\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1131)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Deve\BypassTlsFing\ssl-context-configurator-master\test.py", line 55, in <module>
r = p.request('GET', 'https://tools.scrapfly.io/api/fp/ja3?extended=1')
File "C:\Python38\lib\site-packages\urllib3\request.py", line 74, in request
return self.request_encode_url(
File "C:\Python38\lib\site-packages\urllib3\request.py", line 96, in request_encode_url
return self.urlopen(method, url, **extra_kw)
File "C:\Python38\lib\site-packages\urllib3\poolmanager.py", line 376, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 813, in urlopen
return self.urlopen(
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 813, in urlopen
return self.urlopen(
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 813, in urlopen
return self.urlopen(
File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "C:\Python38\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tools.scrapfly.io', port=443): Max retries exceeded with url: /api/fp/ja3?extended=1 (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HAND
SHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1131)')))
import urllib3
from ssl_context_configurator import SSLContextConfigurator
ssl_context = urllib3.util.ssl_.create_urllib3_context()
with SSLContextConfigurator(ssl_context, libssl_path='libssl.so') as ssl_context_configurator:
ssl_context_configurator.configure_signature_algorithms('ECDSA+SHA256')
pool_manager = urllib3.PoolManager(cert_reqs='CERT_NONE', ssl_context=ssl_context)
pool_manager.request('GET', 'https://tools.scrapfly.io/api/fp/ja3?extended=1')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.