OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
digitalocean
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/17/2025 09:32:20 AM
rwxr-xr-x
📄
Account.py
904 bytes
12/17/2017 06:12:21 PM
rw-r--r--
📄
Action.py
2.03 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Certificate.py
2.94 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Domain.py
3.17 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Droplet.py
19.87 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Firewall.py
8.26 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
FloatingIP.py
3.02 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Image.py
2.8 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Kernel.py
328 bytes
12/17/2017 06:12:21 PM
rw-r--r--
📄
LoadBalancer.py
12.87 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Manager.py
11.62 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Metadata.py
1.3 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Record.py
3.92 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Region.py
386 bytes
12/17/2017 06:12:21 PM
rw-r--r--
📄
SSHKey.py
2.55 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Size.py
453 bytes
12/17/2017 06:12:21 PM
rw-r--r--
📄
Snapshot.py
1.17 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Tag.py
3.83 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
Volume.py
4.2 KB
12/17/2017 06:12:21 PM
rw-r--r--
📄
__init__.py
1.02 KB
12/17/2017 06:12:21 PM
rw-r--r--
📁
__pycache__
-
05/25/2021 01:14:28 PM
rwxr-xr-x
📄
baseapi.py
6.16 KB
12/17/2017 06:12:21 PM
rw-r--r--
Editing: Action.py
Close
# -*- coding: utf-8 -*- from time import sleep from .baseapi import BaseAPI class Action(BaseAPI): def __init__(self, *args, **kwargs): self.id = None self.token = None self.status = None self.type = None self.started_at = None self.completed_at = None self.resource_id = None self.resource_type = None self.region = None self.region_slug = None # Custom, not provided by the json object. self.droplet_id = None super(Action, self).__init__(*args, **kwargs) @classmethod def get_object(cls, api_token, action_id): """ Class method that will return a Action object by ID. """ action = cls(token=api_token, id=action_id) action.load_directly() return action def load_directly(self): action = self.get_data("actions/%s" % self.id) if action: action = action[u'action'] # Loading attributes for attr in action.keys(): setattr(self, attr, action[attr]) def load(self): action = self.get_data( "droplets/%s/actions/%s" % ( self.droplet_id, self.id ) ) if action: action = action[u'action'] # Loading attributes for attr in action.keys(): setattr(self, attr, action[attr]) def wait(self, update_every_seconds=1): """ Wait until the action is marked as completed or with an error. It will return True in case of success, otherwise False. Optional Args: update_every_seconds - int : number of seconds to wait before checking if the action is completed. """ while self.status == u'in-progress': sleep(update_every_seconds) self.load() return self.status == u'completed' def __str__(self): return "<Action: %s %s %s>" % (self.id, self.type, self.status)