Skip to content

Commit

Permalink
Loading all the data inside a specific dictionary as attributes of th…
Browse files Browse the repository at this point in the history
…e class
  • Loading branch information
koalalorenzo committed Aug 13, 2014
1 parent abc6948 commit 5f87208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions digitalocean/Record.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def load(self):
record = self.get_data(url)
if record:
record = record[u'domain_record']
self.id = record['id']
self.type = record[u'type']
self.name = record[u'name']
self.data = record[u'data']
self.priority = record[u'priority']
self.port = record[u'port']
self.weight = record[u'weight']

#Setting the attribute values
for attr in record.keys():
setattr(self,attr,record[attr])
6 changes: 3 additions & 3 deletions digitalocean/SSHKey.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def load(self):

ssh_key = data['ssh_key']

self.public_key = ssh_key['public_key']
self.name = ssh_key['name']
#Setting the attribute values
for attr in ssh_key.keys():
setattr(self,attr,ssh_key[attr])
self.id = ssh_key['id']
self.fingerprint = ssh_key['fingerprint']

def create(self):
"""
Expand Down

0 comments on commit 5f87208

Please sign in to comment.