File tree 2 files changed +10
-10
lines changed 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1
1
login_email='*****'
2
2
login_password='****'
3
- main_domain='nome.tk '
3
+ main_domain='domain.com '
4
4
sub_domain='dht'
5
5
6
6
wanip='iframe.ip138.com/ic.asp'
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
4
-
4
+
5
5
import httplib , urllib
6
6
import re , urllib2 , json
7
7
import socket , sys
8
8
9
9
10
- domain = "linsir.tk "
10
+ domain = "Domain "
11
11
sub_domain = ['@' ,]
12
- email = "vi5i0n@qq .com" # replace with your email
13
- password = "Vision " # replace with your password
12
+ email = "username@email .com" # replace with your email
13
+ password = "passwd " # replace with your password
14
14
15
15
class dnspod (object ):
16
16
"""docstring for dnspod"""
@@ -21,7 +21,7 @@ def __init__(self):
21
21
"format" : "json" ,
22
22
"record_line" : "默认" ,
23
23
}
24
-
24
+
25
25
def get_public_ip (self ):
26
26
data = urllib2 .urlopen ("http://20140507.ip138.com/ic.asp" ).read ()
27
27
ip = re .search ('\d+\.\d+\.\d+\.\d+' ,data ).group (0 )
@@ -30,7 +30,7 @@ def get_public_ip(self):
30
30
def get_domain_ip (self ):
31
31
result = socket .getaddrinfo (domain ,'http' )[0 ][4 ][0 ]
32
32
return result
33
-
33
+
34
34
def post (self ,method ):
35
35
headers = {
"UserAgent" :
"Ddns Client/0.1.0([email protected] )" ,
36
36
"Content-type" : "application/x-www-form-urlencoded" ,
@@ -63,7 +63,7 @@ def get_record_id(self):
63
63
if record ["name" ] in sub_domain :
64
64
name = record ["name" ]
65
65
record_ids [name ] = record ["id" ]
66
-
66
+
67
67
# print record_ids
68
68
return record_ids
69
69
@@ -76,8 +76,8 @@ def update_record(self, ip):
76
76
data = self .post ("Record.Ddns" )
77
77
data = json .loads (data )
78
78
return data ['status' ]['code' ]
79
-
80
-
79
+
80
+
81
81
if __name__ == '__main__' :
82
82
dns = dnspod ()
83
83
try :
You can’t perform that action at this time.
0 commit comments