Initial commit - fsij-server-admin.git - FSIJ server administration tools.

FSIJ server administration tools. Git repo user
summary refs log tree commit diff
path: root/gandi_tool.py
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2014年05月10日 19:44:46 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2014年05月10日 19:44:46 +0900
commit8fb81ae3c99c7a1bf438d0482d442cb4371bbe4e (patch)
treea6ad18b27cf40d07b33690fce22e1e7e4e074cb8 /gandi_tool.py
Initial commit
Diffstat (limited to 'gandi_tool.py')
-rw-r--r--gandi_tool.py 31
1 files changed, 31 insertions, 0 deletions
diff --git a/gandi_tool.py b/gandi_tool.py
new file mode 100644
index 0000000..594dd0a
--- /dev/null
+++ b/gandi_tool.py
@@ -0,0 +1,31 @@
+url='https://rpc.gandi.net/xmlrpc/'
+
+import xmlrpclib
+api = xmlrpclib.ServerProxy(url)
+
+import subprocess
+command=['gpg', '--decrypt', '-o', '-', 'api-key-info.asc' ]
+p = subprocess.Popen(command, stdout=subprocess.PIPE)
+keydata_string = p.communicate()[0]
+
+import json
+keydata = json.loads(keydata_string)
+apikey = keydata['key']
+# validation check: is it 24-char?
+
+version = api.version.info(apikey)
+print("API Version: %s", version)
+print(api.domain.info(apikey, 'fsij.org'))
+
+print(api.domain.forward.count(apikey, 'fsij.org'))
+print(api.domain.forward.list(apikey, 'fsij.org'))
+
+# >>> api.domain.forward.create(apikey, 'mydomain.net', 'admin',
+# ... {'destinations': ['stephanie@example.com']})
+# {'destinations': ['stephanie@example.com'], 'source': 'admin'}
+#
+# >>> api.domain.forward.update(apikey, 'mydomain.net', 'admin', ... {'destinations': ['stephanie@example.com', 'steph@example.com']})
+# {'destinations': ['stephanie@example.com', 'steph@example.com'], 'source': 'admin'}
+#
+# >>> api.domain.forward.delete(apikey, 'mydomain.net', 'admin')
+# True
generated by cgit v1.2.3 (git 2.39.1) at 2025年10月17日 08:49:09 +0000

AltStyle によって変換されたページ (->オリジナル) /