Best Python code snippet using localstack_python
proxy_server.py
Source:proxy_server.py  
...81        if not asynchronous:82            result.join()83        return result84    def _run(*args):85        return _do_start_ssl_proxy(port, target, target_ssl=target_ssl)86    if not asynchronous:87        return _run()88    proxy = FuncThread(_run)89    TMP_THREADS.append(proxy)90    proxy.start()91    return proxy92def _do_start_ssl_proxy(port: int, target: str, target_ssl=False):93    import pproxy94    from localstack.services.generic_proxy import GenericProxy95    if ":" not in str(target):96        target = "127.0.0.1:%s" % target97    LOG.debug("Starting SSL proxy server %s -> %s" % (port, target))98    # create server and remote connection99    server = pproxy.Server("secure+tunnel://0.0.0.0:%s" % port)100    target_proto = "ssl+tunnel" if target_ssl else "tunnel"101    remote = pproxy.Connection("%s://%s" % (target_proto, target))102    args = dict(rserver=[remote], verbose=print)103    # set SSL contexts104    _, cert_file_name, key_file_name = GenericProxy.create_ssl_cert()105    for context in pproxy.server.sslcontexts:106        context.load_cert_chain(cert_file_name, key_file_name)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
