From: Bill Erickson Date: Thu, 18 Jun 2015 15:25:30 +0000 (-0400) Subject: LP#1409055 Python gateway HTTP protocol options X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9a4ed4f37bb2e76658a83a2480e47a7c9f31e554;p=working%2FOpenSRF.git LP#1409055 Python gateway HTTP protocol options * Default to https * Add support for modifying the default protocol * Add support for modifying request-specific protocol Signed-off-by: Bill Erickson --- diff --git a/src/python/osrf/gateway.py b/src/python/osrf/gateway.py index eda1139..33f90d3 100644 --- a/src/python/osrf/gateway.py +++ b/src/python/osrf/gateway.py @@ -8,12 +8,18 @@ import urllib, urllib2, sys, re defaultHost = None class GatewayRequest: + + ''' package-wide default protocol ''' + default_protocol = 'https' + def __init__(self, service, method, params=[]): self.service = service self.method = method self.params = params self.path = 'gateway' self.bytes_read = 0 # for now this, this is really characters read + # request-specific protocol + self.proto = GatewayRequest.default_protocol def setPath(self, path): self.path = path @@ -50,7 +56,7 @@ class GatewayRequest: setDefaultHost = staticmethod(setDefaultHost) def buildURL(self): - return 'http://%s/%s' % (defaultHost, self.path) + return '%s://%s/%s' % (self.proto, defaultHost, self.path) class JSONGatewayRequest(GatewayRequest): def __init__(self, service, method, *params):