from pyramid.config import Configurator
from pyramid.authentication import AuthTktAuthenticationPolicyfrom pyramid.authorization import ACLAuthorizationPolicyimport email.utilsfrom pyramid.authentication import AuthTktAuthenticationPolicyfrom pyramid.authorization import ACLAuthorizationPolicyfrom pyramid.session import SignedCookieSessionFactoryfrom sqlalchemy import engine_from_configfrom .models import DBSession, Userfrom .views.utils import emailfrom .libpn import PNdef main(global_config, **settings):""" This function returns a Pyramid WSGI application."""engine = engine_from_config(settings, 'sqlalchemy.')DBSession.configure(bind=engine)User.metadata.bind = engineauthn_policy = AuthTktAuthenticationPolicy("REDACTED")authz_policy = ACLAuthorizationPolicy()my_session_factory = SignedCookieSessionFactory('REDACTED')config = Configurator(settings=settings,authentication_policy=authn_policy,authorization_policy=authz_policy,)config.set_session_factory(my_session_factory)wsdl_baseurl=settings['WSDL_BASEURL'],company_cache=settings['COMPANY_CACHE'])
import logginglog = logging.getLogger(__name__)from .pysimplesoap112.client import SoapClient as SoapClient112, SoapFault as SoapFault112, SimpleXMLElement as SimpleXMLElement112import requestsimport datetimeimport csvimport osimport base64import tracebackimport boto3import timeimport dateutil.parserimport pickleimport iofrom .StaticDataManager import *# Set working folderworkfolder=os.path.dirname(__file__)if workfolder:os.chdir(workfolder)class Client:def __init__(self):self.url = ""self.cache_path = ""self.client = ""def connect(self):self.client = SoapClient112(wsdl = self.url, cache = self.cache_path)class PN:def __init__(self, wsdl_cache_folder='', wsdl_baseurl='',esign_service_url = '',company_cache=''):ts = time.time()self.security_token = Noneself.wsdl_cache_folder = wsdl_cache_folderself.wsdl_baseurl = wsdl_baseurlself.company_cache_filename = company_cacheself.TransactionService = Client()self.TransactionService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.TransactionService.cache_path = os.path.join(self.wsdl_cache_folder,'cache_transaction')self.TransactionService.connect()self.LoginService = Client()self.LoginService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.LoginService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.LoginService.connect()self.BillingService = Client()self.BillingService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.BillingService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.BillingService.connect()self.PolicyService = Client()self.PolicyService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.PolicyService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.PolicyService.connect()self.NotesService = Client()self.NotesService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.NotesService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.NotesService.connect()self.ClaimsService = Client()self.ClaimsService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.ClaimsService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.ClaimsService.connect()self.PrintingService = Client()self.PrintingService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.PrintingService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.PrintingService.connect()self.AdministrationService = Client()self.AdministrationService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.AdministrationService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.AdministrationService.connect()self.SecurityService = Client()self.SecurityService.url = self.wsdl_baseurl+'XXX.svc?wsdl'self.SecurityService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.SecurityService.connect()self.ESignService = Client()self.ESignService.url esign_service_urlself.ESignService.cache_path = os.path.join(self.wsdl_cache_folder,'XXX')self.ESignService.connect()te = time.time()with io.open("timings.log", "a+", encoding="utf-8") as f:f.write('%r %2.2f sec \n' % ('cache_file_load', te-ts))with io.open("timings.csv", "a+", encoding="utf-8") as f:f.write('%s %r, %2.2f \n' % (datetime.datetime.now(), 'cache_file_load', te-ts))
--
You received this message because you are subscribed to a topic in the Google Groups "pylons-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pylons-discuss/rbXBsUrCKn4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/2ea804d0-1b40-49f2-944a-2f890d92f307%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oh cool there is sorry for the spam https://docs.pylonsproject.org/projects/pyramid-cookbook/en/latest/deployment/forked_threaded_servers.html
--
You received this message because you are subscribed to a topic in the Google Groups "pylons-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pylons-discuss/rbXBsUrCKn4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/psm7o7%2424s%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CACNnZHarKQoxZ_zyta_xCAqg%2BJULdbHQjD8M%3DuaE%2BiMUZMFReQ%40mail.gmail.com.