]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/ddns/ddns-005-Add-changeip-com.patch
Python: Update to 2.7.9
[people/pmueller/ipfire-2.x.git] / src / patches / ddns / ddns-005-Add-changeip-com.patch
1 commit 78046ffe2187d91c61d6c2f910249b8a5be71b08
2 Author: Stefan Schantl <stefan.schantl@ipfire.org>
3 Date: Wed Oct 22 21:39:09 2014 +0200
4
5 Add changeip.com as new provider.
6
7 Fixes #10639.
8
9 diff --git a/README b/README
10 index 5944102..6a06f4b 100644
11 --- a/README
12 +++ b/README
13 @@ -49,6 +49,7 @@ INSTALLATION:
14
15 SUPPORTED PROVIDERS:
16 all-inkl.com
17 + changeip.com
18 dhs.org
19 dns.lightningwirelabs.com
20 dnspark.com
21 diff --git a/ddns.conf.sample b/ddns.conf.sample
22 index d3ac53f..0048a46 100644
23 --- a/ddns.conf.sample
24 +++ b/ddns.conf.sample
25 @@ -30,6 +30,11 @@
26 # secret = XYZ
27 # ttl = 60
28
29 +# [test.changeip.com]
30 +# provider = changeip.com
31 +# username = user
32 +# password = pass
33 +
34 # [test.dhs.org]
35 # provider = dhs.org
36 # username = user
37 diff --git a/src/ddns/providers.py b/src/ddns/providers.py
38 index 1e88995..587d5ff 100644
39 --- a/src/ddns/providers.py
40 +++ b/src/ddns/providers.py
41 @@ -539,6 +539,44 @@ class DDNSProviderBindNsupdate(DDNSProvider):
42 return "\n".join(scriptlet)
43
44
45 +class DDNSProviderChangeIP(DDNSProvider):
46 + handle = "changeip.com"
47 + name = "ChangeIP.com"
48 + website = "https://changeip.com"
49 + protocols = ("ipv4",)
50 +
51 + # Detailed information about the update api can be found here.
52 + # http://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34
53 +
54 + url = "https://nic.changeip.com/nic/update"
55 + can_remove_records = False
56 +
57 + def update_protocol(self, proto):
58 + data = {
59 + "hostname" : self.hostname,
60 + "myip" : self.get_address(proto),
61 + }
62 +
63 + # Send update to the server.
64 + try:
65 + response = self.send_request(self.url, username=self.username, password=self.password,
66 + data=data)
67 +
68 + # Handle error codes.
69 + except urllib2.HTTPError, e:
70 + if e.code == 422:
71 + raise DDNSRequestError(_("Domain not found."))
72 +
73 + raise
74 +
75 + # Handle success message.
76 + if response.code == 200:
77 + return
78 +
79 + # If we got here, some other update error happened.
80 + raise DDNSUpdateError(_("Server response: %s") % output)
81 +
82 +
83 class DDNSProviderDHS(DDNSProvider):
84 handle = "dhs.org"
85 name = "DHS International"