show manifold server URL in auth page
[myslice.git] / engine / manifold_api.py
1 # Manifold API Python interface
2 import xmlrpclib
3 from myslice.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.manifold_server
12     self.port = config.manifold_port
13     self.path = config.manifold_path
14     self.cainfo = cainfo
15     self.errors = []
16     self.trace = []
17     self.calls = {}
18     self.multicall = False
19     self.url = config.manifold_url()
20     self.proxy = xmlrpclib.Server(self.url, verbose=False, allow_none=True)
21
22   def __getattr__(self, methodName):
23       def func(*args, **kwds):
24            print methodName, self.auth, self.url
25            result=getattr(self.proxy, methodName)(self.auth, *args, **kwds)
26            return result
27       return func