diff options
Diffstat (limited to 'pykolab/wap_client/__init__.py')
-rw-r--r-- | pykolab/wap_client/__init__.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pykolab/wap_client/__init__.py b/pykolab/wap_client/__init__.py index 1dd6aab..674673c 100644 --- a/pykolab/wap_client/__init__.py +++ b/pykolab/wap_client/__init__.py @@ -19,6 +19,7 @@ if not hasattr(conf, 'defaults'): API_HOSTNAME = "localhost" API_SCHEME = "http" API_PORT = 80 +API_SSL = False API_BASE = "/kolab-webadmin/api/" kolab_wap_url = conf.get('kolab_wap', 'api_url') @@ -28,6 +29,10 @@ if not kolab_wap_url == None: else: result = None +if hasattr(result, 'scheme') and result.scheme == 'https': + API_SSL = True + API_PORT = 443 + if hasattr(result, 'hostname'): API_HOSTNAME = result.hostname @@ -41,8 +46,6 @@ session_id = None conn = None -from connect import connect - def authenticate(username=None, password=None, domain=None): global session_id @@ -71,7 +74,10 @@ def connect(): global conn if conn == None: - conn = httplib.HTTPConnection(API_HOSTNAME, API_PORT) + if API_SSL: + conn = httplib.HTTPSConnection(API_HOSTNAME, API_PORT) + else: + conn = httplib.HTTPConnection(API_HOSTNAME, API_PORT) conn.connect() return conn |