Explorar o código

:memo: Example for using OVH API with python

DricomDragon hai 1 mes
pai
achega
18582885d0
Modificáronse 1 ficheiros con 24 adicións e 0 borrados
  1. 24 0
      Server/Test/OvhApi/test.py

+ 24 - 0
Server/Test/OvhApi/test.py

@@ -0,0 +1,24 @@
+import ovh
+
+# domain-zone-star-test
+client = ovh.Client(
+    endpoint='ovh-eu',
+    application_key='todo',
+    application_secret='todo',
+    consumer_key='todo',
+)
+
+# Print nice welcome message
+#print("Welcome", client.get('/me')['firstname'])
+#print("My records", client.get('/domain/zone/norwood.bzh/record/5353546247')['target'])
+
+# Create a record
+params = {}
+params['fieldType'] = 'TXT'
+params['subDomain'] = 'hello'
+params['target'] = 'from python'
+params['ttl'] = 600
+
+print('Creating record ...')
+ans = client.post('/domain/zone/norwood.bzh/record', **params)
+print('Record created : ', ans)