filenames without _ (spare my pinkie)
[myslice.git] / engine / manifoldapi.py
diff --git a/engine/manifoldapi.py b/engine/manifoldapi.py
new file mode 100644 (file)
index 0000000..b125a59
--- /dev/null
@@ -0,0 +1,29 @@
+# Manifold API Python interface
+import xmlrpclib
+from myslice.config import Config
+
+debug=True
+
+class ManifoldAPI:
+
+  def __init__(self, auth=None, cainfo=None):
+
+    config = Config()
+    self.auth = auth
+    self.server = config.manifold_server
+    self.port = config.manifold_port
+    self.path = config.manifold_path
+    self.cainfo = cainfo
+    self.errors = []
+    self.trace = []
+    self.calls = {}
+    self.multicall = False
+    self.url = config.manifold_url()
+    self.proxy = xmlrpclib.Server(self.url, verbose=False, allow_none=True)
+
+  def __getattr__(self, methodName):
+      def func(*args, **kwds):
+        result=getattr(self.proxy, methodName)(self.auth, *args, **kwds)
+        if debug: print methodName, self.auth, self.url,'->',result
+        return result
+      return func