From 18adf28e18e0fb3f2d6567df3c5f5f2a037e355d Mon Sep 17 00:00:00 2001 From: Evstrat_BG Date: Fri, 15 Mar 2019 13:50:00 +0300 Subject: [PATCH] add update method to Record class add update domain record support --- digitalocean/Record.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/digitalocean/Record.py b/digitalocean/Record.py index f30327b2..0ebbb733 100644 --- a/digitalocean/Record.py +++ b/digitalocean/Record.py @@ -122,5 +122,30 @@ def load(self): for attr in record.keys(): setattr(self, attr, record[attr]) + def update(self): + """ + Update existing record + """ + + data = { + "id": self.id, + "type": self.type, + "data": self.data, + "name": self.name, + "priority": self.priority, + "port": self.port, + "ttl": self.ttl, + "weight": self.weight, + "flags": self.flags, + "tags": self.tags + } + + url = "domains/%s/records/%s" % (self.domain, self.id) + return self.get_data( + url=url, + type=PUT, + params=data + ) + def __str__(self): return "" % (self.id, self.domain)