Authentication with manifold api backend
[myslice.git] / engine / manifold_api.py
1 # Manifold API Python interface
2 import xmlrpclib
3 #from util.config import Config
4
5 class ManifoldAPI:
6
7   def __init__(self, auth=None, cainfo=None):
8
9     #config = Config()
10     self.auth = auth
11     #self.server = config.server
12     #self.port = config.port
13     #self.path = config.path
14     self.server = 'demo.myslice.info'
15     self.port = '7080'
16     self.path = '/'
17     self.cainfo = cainfo
18     self.errors = []
19     self.trace = []
20     self.calls = {}
21     self.multicall = False
22     self.url = "http://"+self.server+":"+self.port+"/"
23     self.proxy = xmlrpclib.Server(self.url, verbose=False, allow_none=True)
24
25   def __getattr__(self, methodName):
26       def func(*args, **kwds):
27            print methodName, self.auth, self.url
28            result=getattr(self.proxy, methodName)(self.auth, *args, **kwds)
29            return result
30       return func