Skip to content

Commit

Permalink
Removed call_api: not useful anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
koalalorenzo committed Aug 11, 2014
1 parent 5b99cc6 commit 148756d
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions digitalocean/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,6 @@ def __init__(self, token=""):
if token:
self.token = token

def __call_api(self, type, path, params=dict()):
payload = {}
headers = {'Authorization':'Bearer ' + self.token}
payload.update(params)
if type == 'POST':
headers['content-type'] = 'application/json'
r = requests.post("https://api.digitalocean.com/v2/images/%s%s" %
(self.id, path),
headers=headers,
params=payload)
elif type == 'PUT':
headers['content-type'] = 'application/json'
r = requests.put("https://api.digitalocean.com/v2/images/%s%s" %
(self.id, path),
headers=headers,
params=payload)
elif type == 'DELETE':
headers['content-type'] = 'application/x-www-form-urlencoded'
r = requests.delete("https://api.digitalocean.com/v2/images/%s" %
(self.id),
headers=headers,
params=payload)
# A successful delete returns "204 No Content"
if r.status_code != 204:
data = r.json()
self.call_response = data
if r.status_code != requests.codes.ok:
msg = [data[m] for m in ("id", "message") if m in data][1]
raise Exception(msg)

return data

def destroy(self):
"""
Destroy the image
Expand Down

0 comments on commit 148756d

Please sign in to comment.