def getURL(self, url, headers): host = settings.RESTCLIENTS_CATALYST_HOST if hasattr(settings, "RESTCLIENTS_CATALYST_CERT_FILE"): Live.pool = get_con_pool(host, settings.RESTCLIENTS_CATALYST_KEY_FILE, settings.RESTCLIENTS_CATALYST_CERT_FILE) else: Live.pool = get_con_pool(host) if hasattr(settings, "RESTCLIENTS_CATALYST_SOL_AUTH_PRIVATE_KEY"): # Use js_rest instead of rest, to avoid certificate issues url = url.replace("/rest/", "/js_rest/") now_with_tz = datetime.datetime.now( pytz.utc).strftime("%a %b %d %H:%M:%S %Z %Y") header_base = "%s\nGET\n%s\n%s\n" % ( settings.RESTCLIENTS_CATALYST_SOL_AUTH_PRIVATE_KEY, url, now_with_tz) public_key = settings.RESTCLIENTS_CATALYST_SOL_AUTH_PUBLIC_KEY hashed = hashlib.sha1(header_base).hexdigest() headers["Authorization"] = "SolAuth %s:%s" % (public_key, hashed) headers["Date"] = now_with_tz return get_live_url(Live.pool, "GET", host, url, headers=headers)
def getURL(self, url, headers): host = settings.RESTCLIENTS_CATALYST_HOST if hasattr(settings, "RESTCLIENTS_CATALYST_CERT_FILE"): Live.pool = get_con_pool(host, settings.RESTCLIENTS_CATALYST_KEY_FILE, settings.RESTCLIENTS_CATALYST_CERT_FILE) else: Live.pool = get_con_pool(host) if hasattr(settings, "RESTCLIENTS_CATALYST_SOL_AUTH_PRIVATE_KEY"): # Use js_rest instead of rest, to avoid certificate issues url = url.replace("/rest/", "/js_rest/") now_with_tz = datetime.datetime.now(pytz.utc).strftime( "%a %b %d %H:%M:%S %Z %Y") header_base = "%s\nGET\n%s\n%s\n" % ( settings.RESTCLIENTS_CATALYST_SOL_AUTH_PRIVATE_KEY, url, now_with_tz ) public_key = settings.RESTCLIENTS_CATALYST_SOL_AUTH_PUBLIC_KEY hashed = hashlib.sha1(header_base).hexdigest() headers["Authorization"] = "SolAuth %s:%s" % (public_key, hashed) headers["Date"] = now_with_tz return get_live_url(Live.pool, "GET", host, url, headers=headers)
def set_pool(self): if Live.pool is None or Live.host is None: Live.host = settings.RESTCLIENTS_BRIDGE_HOST Live.pool = get_con_pool(Live.host, verify_https=True, max_pool_size=BRIDGE_MAX_POOL_SIZE, socket_timeout=BRIDGE_SOCKET_TIMEOUT)
def _get_pool(self, host): socket_timeout = 15 # default values if hasattr(settings, "RESTCLIENTS_O365_SOCKET_TIMEOUT"): socket_timeout = settings.RESTCLIENTS_O365_SOCKET_TIMEOUT return get_con_pool(host, verify_https=Live.verify_https, socket_timeout=socket_timeout)
def getURL(self, url, headers): host = 'http://www3.bookstore.washington.edu/' if Live.pool == None: Live.pool = get_con_pool(host, None, None) return get_live_url (Live.pool, 'GET', host, url, headers=headers, service_name='book')
def getURL(self, url, headers): host = settings.RESTCLIENTS_R25_HOST if Live.pool is None: Live.pool = get_con_pool(host) return get_live_url(Live.pool, "GET", host, url, headers=headers)
def pool(self): if Live._pool is None: Live._pool = get_con_pool(settings.RESTCLIENTS_IRWS_HOST, settings.RESTCLIENTS_IRWS_KEY_FILE, settings.RESTCLIENTS_IRWS_CERT_FILE, max_pool_size=IRWS_MAX_POOL_SIZE) return Live._pool
def _get_pool(self): host = settings.RESTCLIENTS_CANVAS_HOST socket_timeout = 15 # default values if hasattr(settings, "RESTCLIENTS_CANVAS_SOCKET_TIMEOUT"): socket_timeout = settings.RESTCLIENTS_CANVAS_SOCKET_TIMEOUT return get_con_pool(host, verify_https=Live.verify_https, socket_timeout=socket_timeout)
def set_pool(self): if Live.host is None: Live.host = settings.RESTCLIENTS_MAILMAN_HOST if Live.pool is None: Live.pool = get_con_pool( Live.host, max_pool_size=MAILMAN_MAX_POOL_SIZE, socket_timeout=get_timeout('mailman'))
def getURL(self, url, headers): if MDOTLive.pool is None: MDOTLive.pool = get_con_pool(settings.RESTCLIENTS_MDOT_HOST) return get_live_url(MDOTLive.pool, 'GET', settings.RESTCLIENTS_MDOT_HOST, url, headers=headers, service_name='mdot')
def getURL(self, url, headers): eos_host = getattr(settings, 'RESTCLIENTS_EOS_HOST', None) if eos_host: if EOS_DAO.pool is None: EOS_DAO.pool = get_con_pool(eos_host) return get_live_url(EOS_DAO.pool, 'GET', eos_host, url, headers=headers, service_name='eos') return get_mockdata_url('eos', 'file', url, headers)
def getURL(self, url, headers, subdomain): host = self._get_host(subdomain) if subdomain not in Live.pool: Live.pool[subdomain] = get_con_pool(host, key_file=settings.RESTCLIENTS_IASYSTEM_KEY_FILE, cert_file=settings.RESTCLIENTS_IASYSTEM_CERT_FILE) return get_live_url(Live.pool[subdomain], "GET", host, url, headers=headers, service_name="iasystem")
def getURL(self, url, headers): if Live.pool == None: Live.pool = get_con_pool(settings.RESTCLIENTS_PWS_HOST, settings.RESTCLIENTS_PWS_KEY_FILE, settings.RESTCLIENTS_PWS_CERT_FILE, max_pool_size= PWS_MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_PWS_HOST, url, headers=headers, service_name='pws')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_LIBCURRICS_HOST, max_pool_size=LIB_MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_LIBCURRICS_HOST, url, headers=headers, service_name='libcurrics')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_PWS_HOST, settings.RESTCLIENTS_PWS_KEY_FILE, settings.RESTCLIENTS_PWS_CERT_FILE, max_pool_size=PWS_MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_PWS_HOST, url, headers=headers, service_name='pws')
def putURL(self, url, headers, body): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_SWS_HOST, settings.RESTCLIENTS_SWS_KEY_FILE, settings.RESTCLIENTS_SWS_CERT_FILE, max_pool_size=SWS_MAX_POOL_SIZE, socket_timeout=get_timeout('sws')) return get_live_url(Live.pool, 'PUT', settings.RESTCLIENTS_SWS_HOST, url, headers=headers, body=body, service_name='sws')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_HFS_HOST, settings.RESTCLIENTS_HFS_KEY_FILE, settings.RESTCLIENTS_HFS_CERT_FILE, max_pool_size=HFS_MAX_POOL_SIZE, socket_timeout=HFS_SOCKET_TIMEOUT) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_HFS_HOST, url, headers=headers, service_name='hfs')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_LIBRARIES_HOST, settings.RESTCLIENTS_LIBRARIES_KEY_FILE, settings.RESTCLIENTS_LIBRARIES_CERT_FILE, max_pool_size=LIB_MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_LIBRARIES_HOST, url, headers=headers, service_name='libraries')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_MYPLAN_HOST, settings.RESTCLIENTS_MYPLAN_KEY_FILE, settings.RESTCLIENTS_MYPLAN_CERT_FILE, max_pool_size=MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', HOST, url, headers=headers, service_name='myplan')
def putURL(self, url, headers, body): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_SWS_HOST, settings.RESTCLIENTS_SWS_KEY_FILE, settings.RESTCLIENTS_SWS_CERT_FILE, max_pool_size=SWS_MAX_POOL_SIZE) return get_live_url(Live.pool, 'PUT', settings.RESTCLIENTS_SWS_HOST, url, headers=headers, body=body, service_name='sws')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_GRAD_HOST, settings.RESTCLIENTS_GRAD_KEY_FILE, settings.RESTCLIENTS_GRAD_CERT_FILE, max_pool_size=GRAD_MAX_POOL_SIZE, socket_timeout=get_timeout("grad")) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_GRAD_HOST, url, headers=headers, service_name='grad')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_UWNETID_HOST, settings.RESTCLIENTS_UWNETID_KEY_FILE, settings.RESTCLIENTS_UWNETID_CERT_FILE, max_pool_size=UWNETID_MAX_POOL_SIZE, socket_timeout=UWNETID_SOCKET_TIMEOUT) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_UWNETID_HOST, url, headers=headers, service_name='uwnetid')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_UPASS_HOST, settings.RESTCLIENTS_UPASS_KEY_FILE, settings.RESTCLIENTS_UPASS_CERT_FILE, max_pool_size=MAX_POOL_SIZE, socket_timeout=get_timeout('upass')) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_UPASS_HOST, url, headers=headers, service_name='upass')
def postURL(self, url, headers, body): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_UWNETID_HOST, settings.RESTCLIENTS_UWNETID_KEY_FILE, settings.RESTCLIENTS_UWNETID_CERT_FILE, max_pool_size=UWNETID_MAX_POOL_SIZE, socket_timeout=get_timeout('uwnetid')) return get_live_url(Live.pool, 'POST', settings.RESTCLIENTS_UWNETID_HOST, url, headers=headers, body=body, service_name='uwnetid')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_DIGITLIB_HOST, settings.RESTCLIENTS_DIGITLIB_KEY_FILE, settings.RESTCLIENTS_DIGITLIB_CERT_FILE, max_pool_size=DIGITLIB_MAX_POOL_SIZE, socket_timeout=DIGITLIB_SOCKET_TIMEOUT) redirect = getattr(settings, "RESTCLIENTS_DIGITLIB_REDIRECT", True) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_DIGITLIB_HOST, url, headers=headers, redirect=redirect, service_name='digitlib')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_LIBRARIES_HOST, settings.RESTCLIENTS_LIBRARIES_KEY_FILE, settings.RESTCLIENTS_LIBRARIES_CERT_FILE, max_pool_size=LIB_MAX_POOL_SIZE) # For rest router... url_prefix = getattr(settings, "RESTCLIENTS_LIBRARIES_PREFIX", "") url = "%s%s" % (url_prefix, url) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_LIBRARIES_HOST, url, headers=headers, service_name='libraries')
def getURL(self, url, headers): host = getattr(settings, "RESTCLIENTS_BOOKSTORE_HOST", 'http://www3.bookstore.washington.edu/') if Live.pool is None: cert = getattr(settings, "RESTCLIENTS_BOOKSTORE_CERT", None) key = getattr(settings, "RESTCLIENTS_BOOKSTORE_KEY", None) Live.pool = get_con_pool(host, key, cert) # For rest router... url_prefix = getattr(settings, "RESTCLIENTS_BOOKSTORE_PREFIX", "") url = "%s%s" % (url_prefix, url) return get_live_url(Live.pool, 'GET', host, url, headers=headers, service_name='book')
def getURL(self, url, headers): host = getattr(settings, "RESTCLIENTS_BOOKSTORE_HOST", 'http://www3.bookstore.washington.edu/') if Live.pool is None: cert = getattr(settings, "RESTCLIENTS_BOOKSTORE_CERT", None) key = getattr(settings, "RESTCLIENTS_BOOKSTORE_KEY", None) Live.pool = get_con_pool(host, key, cert) # For rest router... url_prefix = getattr(settings, "RESTCLIENTS_BOOKSTORE_PREFIX", "") url = "%s%s" % (url_prefix, url) return get_live_url(Live.pool, 'GET', host, url, headers=headers, service_name='book', socket_timeout=get_timeout("book"))
def getURL(self, url, headers): bearer_key = getattr(settings, 'RESTCLIENTS_SWS_OAUTH_BEARER', None) if bearer_key is not None: headers["Authorization"] = "Bearer %s" % bearer_key if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_SWS_HOST, settings.RESTCLIENTS_SWS_KEY_FILE if ( bearer_key is None) else None, settings.RESTCLIENTS_SWS_CERT_FILE if ( bearer_key is None) else None, max_pool_size=SWS_MAX_POOL_SIZE, socket_timeout=get_timeout('sws')) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_SWS_HOST, url, headers=headers, service_name='sws')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_DIGITLIB_HOST, settings.RESTCLIENTS_DIGITLIB_KEY_FILE, settings.RESTCLIENTS_DIGITLIB_CERT_FILE, max_pool_size=DIGITLIB_MAX_POOL_SIZE, socket_timeout=DIGITLIB_SOCKET_TIMEOUT) redirect = getattr(settings, "RESTCLIENTS_DIGITLIB_REDIRECT", True) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_DIGITLIB_HOST, url, headers=headers, redirect=redirect, service_name='digitlib')
def getURL(self, url, headers): if Live.pool is None: Live.pool = get_con_pool( settings.RESTCLIENTS_LIBRARIES_HOST, settings.RESTCLIENTS_LIBRARIES_KEY_FILE, settings.RESTCLIENTS_LIBRARIES_CERT_FILE, max_pool_size=LIB_MAX_POOL_SIZE, socket_timeout=get_timeout('library')) # For rest router... url_prefix = getattr(settings, "RESTCLIENTS_LIBRARIES_PREFIX", "") url = "%s%s" % (url_prefix, url) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_LIBRARIES_HOST, url, headers=headers, service_name='libraries')
def getURL(self, url, headers): bearer_key = getattr(settings, 'RESTCLIENTS_SWS_OAUTH_BEARER', None) if bearer_key is not None: headers["Authorization"] = "Bearer %s" % bearer_key if Live.pool is None: Live.pool = get_con_pool(settings.RESTCLIENTS_SWS_HOST, settings.RESTCLIENTS_SWS_KEY_FILE if (bearer_key is None) else None, settings.RESTCLIENTS_SWS_CERT_FILE if (bearer_key is None) else None, max_pool_size=SWS_MAX_POOL_SIZE) return get_live_url(Live.pool, 'GET', settings.RESTCLIENTS_SWS_HOST, url, headers=headers, service_name='sws')
def _get_pool(self): nws_key_file = None nws_cert_file = None max_pool_size = 10 #default values socket_timeout = 15 #default values if settings.RESTCLIENTS_NWS_KEY_FILE and settings.RESTCLIENTS_NWS_CERT_FILE: nws_key_file = settings.RESTCLIENTS_NWS_KEY_FILE nws_cert_file = settings.RESTCLIENTS_NWS_CERT_FILE if hasattr(settings, "RESTCLIENTS_NWS_MAX_POOL_SIZE"): max_pool_size = settings.RESTCLIENTS_NWS_MAX_POOL_SIZE if hasattr(settings, "RESTCLIENTS_NWS_SOCKET_TIMEOUT"): socket_timeout = settings.RESTCLIENTS_NWS_SOCKET_TIMEOUT return get_con_pool(settings.RESTCLIENTS_NWS_HOST, nws_key_file, nws_cert_file, max_pool_size=max_pool_size, socket_timeout=socket_timeout)
def getURL(self, url, headers, subdomain): host = self._get_host(subdomain) if subdomain not in Live.pool: Live.pool[subdomain] = get_con_pool( host, key_file=settings.RESTCLIENTS_IASYSTEM_KEY_FILE, cert_file=settings.RESTCLIENTS_IASYSTEM_CERT_FILE, socket_timeout=getattr(settings, "RESTCLIENTS_IASYSTEM_SOCKET_TIMEOUT", IAS_SOCKET_TIMEOUT), max_pool_size=getattr(settings, "RESTCLIENTS_IASYSTEM_MAX_POOL_SIZE", IAS_MAX_POOL_SIZE)) return get_live_url(Live.pool[subdomain], "GET", host, url, headers=headers, service_name="iasystem")
def _get_pool(self): nws_key_file = None nws_cert_file = None max_pool_size = 10 # default values socket_timeout = 15 # default values if settings.RESTCLIENTS_NWS_KEY_FILE and \ settings.RESTCLIENTS_NWS_CERT_FILE: nws_key_file = settings.RESTCLIENTS_NWS_KEY_FILE nws_cert_file = settings.RESTCLIENTS_NWS_CERT_FILE if hasattr(settings, "RESTCLIENTS_NWS_MAX_POOL_SIZE"): max_pool_size = settings.RESTCLIENTS_NWS_MAX_POOL_SIZE if hasattr(settings, "RESTCLIENTS_NWS_SOCKET_TIMEOUT"): socket_timeout = settings.RESTCLIENTS_NWS_SOCKET_TIMEOUT return get_con_pool(settings.RESTCLIENTS_NWS_HOST, nws_key_file, nws_cert_file, max_pool_size=max_pool_size, socket_timeout=socket_timeout)
def _get_pool(self): return get_con_pool(settings.RESTCLIENTS_GWS_HOST, settings.RESTCLIENTS_GWS_KEY_FILE, settings.RESTCLIENTS_GWS_CERT_FILE, max_pool_size=GWS_MAX_POOL_SIZE)
def set_pool(): if LiveSea.pool is None: LiveSea.pool = get_con_pool(settings.RESTCLIENTS_TRUMBA_HOST, None, None)
def _get_pool(self): return get_con_pool(CalendarLive.TRUMBA_HOST, max_pool_size = CalendarLive.MAX_POOL_SIZE)
def _get_pool(self): return get_con_pool(settings.RESTCLIENTS_GWS_HOST, settings.RESTCLIENTS_GWS_KEY_FILE, settings.RESTCLIENTS_GWS_CERT_FILE, max_pool_size = GWS_MAX_POOL_SIZE)
def _get_pool(self): return get_con_pool(CalendarLive.TRUMBA_HOST, max_pool_size=CalendarLive.MAX_POOL_SIZE, socket_timeout=get_timeout('trumba'))
def set_pool(): if LiveSea.pool is None: LiveSea.pool = get_con_pool(settings.RESTCLIENTS_TRUMBA_HOST, None, None, socket_timeout=get_timeout('trumba'))