Skip to content

Commit

Permalink
Basic implementation of Digital Ocean Metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
koalalorenzo committed Oct 19, 2014
1 parent 364deab commit 79954d5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions digitalocean/Metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from .baseapi import BaseAPI

class Metadata(BaseAPI):
droplet_id = None
end_point = "http://169.254.169.254/metadata/v1"

def __init__(self, *args, **kwargs):
super(Metadata, self).__init__(*args, **kwargs)
self.end_point = "http://169.254.169.254/metadata/v1"

def load(self):
metadata = self.get_data(".json")

for attr in metadata.keys():
setattr(self,attr,metadata[attr])

return self

def __str__(self):
return "%s" % self.droplet_id

0 comments on commit 79954d5

Please sign in to comment.