forked from DNSPod/dnspod-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
46 lines (34 loc) · 1.3 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from dnspod.apicn import *
def main():
email = "Your Email Here"
password = "Your Password Here"
import random
domain = "test%d.com" % random.randint(1000, 100000)
print "DomainCreate", domain
api = DomainCreate(domain, email=email, password=password)
domain_id = api().get("domain", {}).get("id")
print "%s's id is %s" % (domain, domain_id)
print "DomainList"
api = DomainList(email=email, password=password)
print api().get("domains")
print "RecordType"
api = RecordType("D_Ultra", email=email, password=password)
print api().get("types")
print "RecordLine"
api = RecordLine("D_Free", email=email, password=password)
print api().get("lines")
print "RecordCreate"
api = RecordCreate("www", "A", u'默认'.encode("utf8"), '1.1.1.1', 600, domain_id=domain_id, email=email, password=password)
record = api().get("record", {})
record_id = record.get("id")
print "Record id", record_id
print "RecordList"
api = RecordList(domain_id, email=email, password=password)
print api().get("records")
print "DomainRemove"
api = DomainRemove(domain_id, email=email, password=password)
print api()
if __name__ == '__main__':
main()