+ def update_protocol(self, proto):
+ data = {
+ "myip" : self.get_address(proto, "-"),
+ "hostname" : self.hostname,
+ }
+
+ # Send update to the server.
+ response = self.send_request(self.url, data=data,
+ username=self.username, password=self.password)
+
+ # Get the full response message.
+ output = response.read()
+
+ # Remove all leading and trailing whitespace.
+ output = output.strip()
+
+ # Handle success messages.
+ if output.startswith("NOERROR"):
+ return
+
+ # Handle error codes.
+ if output.startswith("NOACCESS"):
+ raise DDNSAuthenticationError
+
+ elif output.startswith("NOSERVICE"):
+ raise DDNSRequestError(_("Dynamic DNS is not turned on for this domain."))
+
+ elif output.startswith("ILLEGAL INPUT"):
+ raise DDNSRequestError(_("Invalid data has been sent."))
+
+ elif output.startswith("TOOSOON"):
+ raise DDNSRequestError(_("Too frequent update requests have been sent."))
+
+ # If we got here, some other update error happened.
+ raise DDNSUpdateError
+