Search is not available for this dataset
text stringlengths 75 104k |
|---|
def get_tags(self):
"""List all tags as Tag objects."""
res = self.get_request('/tag')
return [Tag(cloud_manager=self, **tag) for tag in res['tags']['tag']] |
def get_tag(self, name):
"""Return the tag as Tag object."""
res = self.get_request('/tag/' + name)
return Tag(cloud_manager=self, **res['tag']) |
def create_tag(self, name, description=None, servers=[]):
"""
Create a new Tag. Only name is mandatory.
Returns the created Tag object.
"""
servers = [str(server) for server in servers]
body = {'tag': Tag(name, description, servers).to_dict()}
res = self.request(... |
def _modify_tag(self, name, description, servers, new_name):
"""
PUT /tag/name. Returns a dict that can be used to create a Tag object.
Private method used by the Tag class and TagManager.modify_tag.
"""
body = {'tag': Tag(new_name, description, servers).to_dict()}
res =... |
def modify_tag(self, name, description=None, servers=None, new_name=None):
"""
PUT /tag/name. Returns a new Tag object based on the API response.
"""
res = self._modify_tag(name, description, servers, new_name)
return Tag(cloud_manager=self, **res['tag']) |
def remove_tags(self, server, tags):
"""
Remove tags from a server.
- server: Server object or UUID string
- tags: list of Tag objects or strings
"""
uuid = str(server)
tags = [str(tag) for tag in tags]
url = '/server/{0}/untag/{1}'.format(uuid, ','.join... |
def assignIfExists(opts, default=None, **kwargs):
"""
Helper for assigning object attributes from API responses.
"""
for opt in opts:
if(opt in kwargs):
return kwargs[opt]
return default |
def try_it_n_times(operation, expected_error_codes, custom_error='operation failed', n=10):
"""
Try a given operation (API call) n times.
Raises if the API call fails with an error_code that is not expected.
Raises if the API call has not succeeded within n attempts.
Waits 3 seconds betwee each att... |
def hkdf_extract(salt, input_key_material, hash=hashlib.sha512):
'''
Extract a pseudorandom key suitable for use with hkdf_expand
from the input_key_material and a salt using HMAC with the
provided hash (default SHA-512).
salt should be a random, application-specific byte string. If
salt is None or the empty str... |
def hkdf_expand(pseudo_random_key, info=b"", length=32, hash=hashlib.sha512):
'''
Expand `pseudo_random_key` and `info` into a key of length `bytes` using
HKDF's expand function based on HMAC with the provided hash (default
SHA-512). See the HKDF draft RFC and paper for usage notes.
'''
hash_len = hash().digest_s... |
def expand(self, info=b"", length=32):
'''
Generate output key material based on an `info` value
Arguments:
- info - context to generate the OKM
- length - length in bytes of the key to generate
See the HKDF draft RFC for guidance.
'''
return hkdf_expand(self._prk, info, length, self._hash) |
def login_user_block(username, ssh_keys, create_password=True):
"""
Helper function for creating Server.login_user blocks.
(see: https://www.upcloud.com/api/8-servers/#create-server)
"""
block = {
'create_password': 'yes' if create_password is True else 'no',
'ssh_keys': {
... |
def _reset(self, server, **kwargs):
"""
Reset the server object with new values given as params.
- server: a dict representing the server. e.g the API response.
- kwargs: any meta fields such as cloud_manager and populated.
Note: storage_devices and ip_addresses may be given in... |
def populate(self):
"""
Sync changes from the API to the local object.
Note: syncs ip_addresses and storage_devices too (/server/uuid endpoint)
"""
server, IPAddresses, storages = self.cloud_manager.get_server_data(self.uuid)
self._reset(
server,
... |
def save(self):
"""
Sync local changes in server's attributes to the API.
Note: DOES NOT sync IPAddresses and storage_devices,
use add_ip, add_storage, remove_ip, remove_storage instead.
"""
# dict comprehension that also works with 2.6
# http://stackoverflow.com... |
def shutdown(self, hard=False, timeout=30):
"""
Shutdown/stop the server. By default, issue a soft shutdown with a timeout of 30s.
After the a timeout a hard shutdown is performed if the server has not stopped.
Note: API responds immediately (unlike in start), with state: started.
... |
def start(self, timeout=120):
"""
Start the server. Note: slow and blocking request.
The API waits for confirmation from UpCloud's IaaS backend before responding.
"""
path = '/server/{0}/start'.format(self.uuid)
self.cloud_manager.post_request(path, timeout=timeout)
... |
def restart(self, hard=False, timeout=30, force=True):
"""
Restart the server. By default, issue a soft restart with a timeout of 30s
and a hard restart after the timeout.
After the a timeout a hard restart is performed if the server has not stopped.
Note: API responds immediat... |
def add_ip(self, family='IPv4'):
"""
Allocate a new (random) IP-address to the Server.
"""
IP = self.cloud_manager.attach_ip(self.uuid, family)
self.ip_addresses.append(IP)
return IP |
def remove_ip(self, IPAddress):
"""
Release the specified IP-address from the server.
"""
self.cloud_manager.release_ip(IPAddress.address)
self.ip_addresses.remove(IPAddress) |
def add_storage(self, storage=None, type='disk', address=None):
"""
Attach the given storage to the Server.
Default address is next available.
"""
self.cloud_manager.attach_storage(server=self.uuid,
storage=storage.uuid,
... |
def remove_storage(self, storage):
"""
Remove Storage from a Server.
The Storage must be a reference to an object in
Server.storage_devices or the method will throw and Exception.
A Storage from get_storage(uuid) will not work as it is missing the 'address' property.
""... |
def add_tags(self, tags):
"""
Add tags to a server. Accepts tags as strings or Tag objects.
"""
if self.cloud_manager.assign_tags(self.uuid, tags):
tags = self.tags + [str(tag) for tag in tags]
object.__setattr__(self, 'tags', tags) |
def remove_tags(self, tags):
"""
Add tags to a server. Accepts tags as strings or Tag objects.
"""
if self.cloud_manager.remove_tags(self, tags):
new_tags = [tag for tag in self.tags if tag not in tags]
object.__setattr__(self, 'tags', new_tags) |
def configure_firewall(self, FirewallRules):
"""
Helper function for automatically adding several FirewallRules in series.
"""
firewall_rule_bodies = [
FirewallRule.to_dict()
for FirewallRule in FirewallRules
]
return self.cloud_manager.configure_f... |
def prepare_post_body(self):
"""
Prepare a JSON serializable dict from a Server instance with nested.
Storage instances.
"""
body = dict()
# mandatory
body['server'] = {
'hostname': self.hostname,
'zone': self.zone,
'title': se... |
def to_dict(self):
"""
Prepare a JSON serializable dict for read-only purposes.
Includes storages and IP-addresses.
Use prepare_post_body for POST and .save() for PUT.
"""
fields = dict(vars(self).items())
if self.populated:
fields['ip_addresses'] = ... |
def get_ip(self, access='public', addr_family=None, strict=None):
"""
Return the server's IP address.
Params:
- addr_family: IPv4, IPv6 or None. None prefers IPv4 but will
return IPv6 if IPv4 addr was not available.
- access: 'public' or 'private'
... |
def get_public_ip(self, addr_family=None, *args, **kwargs):
"""Alias for get_ip('public')"""
return self.get_ip('public', addr_family, *args, **kwargs) |
def get_private_ip(self, addr_family=None, *args, **kwargs):
"""Alias for get_ip('private')"""
return self.get_ip('private', addr_family, *args, **kwargs) |
def _wait_for_state_change(self, target_states, update_interval=10):
"""
Blocking wait until target_state reached. update_interval is in seconds.
Warning: state change must begin before calling this method.
"""
while self.state not in target_states:
if self.state == ... |
def ensure_started(self):
"""
Start a server and waits (blocking wait) until it is fully started.
"""
# server is either starting or stopping (or error)
if self.state in ['maintenance', 'error']:
self._wait_for_state_change(['stopped', 'started'])
if self.sta... |
def stop_and_destroy(self, sync=True):
"""
Destroy a server and its storages. Stops the server before destroying.
Syncs the server state from the API, use sync=False to disable.
"""
def _self_destruct():
"""destroy the server and all storages attached to it."""
... |
def revert(self):
"""Revert the state to the version stored on disc."""
if self.filepath:
if path.isfile(self.filepath):
serialised_file = open(self.filepath, "r")
try:
self.state = json.load(serialised_file)
except ValueErr... |
def sync(self):
"""Synchronise and update the stored state to the in-memory state."""
if self.filepath:
serialised_file = open(self.filepath, "w")
json.dump(self.state, serialised_file)
serialised_file.close()
else:
print("Filepath to the persisten... |
def _reset(self, **kwargs):
"""
Reset after repopulating from API (or when initializing).
"""
# set object attributes from params
for key in kwargs:
setattr(self, key, kwargs[key])
# set defaults (if need be) where the default is not None
for attr in ... |
def to_dict(self):
"""
Return a dict that can be serialised to JSON and sent to UpCloud's API.
"""
return dict(
(attr, getattr(self, attr))
for attr in self.ATTRIBUTES
if hasattr(self, attr)
) |
def _require_bucket(self, bucket_name):
""" Also try to create the bucket. """
if not self.exists(bucket_name) and not self.claim_bucket(bucket_name):
raise OFSException("Invalid bucket: %s" % bucket_name)
return self._get_bucket(bucket_name) |
def del_stream(self, bucket, label):
""" Will fail if the bucket or label don't exist """
bucket = self._require_bucket(bucket)
key = self._require_key(bucket, label)
key.delete() |
def authenticate_request(self, method, bucket='', key='', headers=None):
'''Authenticate a HTTP request by filling in Authorization field header.
:param method: HTTP method (e.g. GET, PUT, POST)
:param bucket: name of the bucket.
:param key: name of key within bucket.
:param hea... |
def get_resources_to_check(client_site_url, apikey):
"""Return a list of resource IDs to check for broken links.
Calls the client site's API to get a list of resource IDs.
:raises CouldNotGetResourceIDsError: if getting the resource IDs fails
for any reason
"""
url = client_site_url + u"d... |
def get_url_for_id(client_site_url, apikey, resource_id):
"""Return the URL for the given resource ID.
Contacts the client site's API to get the URL for the ID and returns it.
:raises CouldNotGetURLError: if getting the URL fails for any reason
"""
# TODO: Handle invalid responses from the client... |
def check_url(url):
"""Check whether the given URL is dead or alive.
Returns a dict with four keys:
"url": The URL that was checked (string)
"alive": Whether the URL was working, True or False
"status": The HTTP status code of the response from the URL,
e.g. 200, 401, 500 (... |
def upsert_result(client_site_url, apikey, resource_id, result):
"""Post the given link check result to the client site."""
# TODO: Handle exceptions and unexpected results.
url = client_site_url + u"deadoralive/upsert"
params = result.copy()
params["resource_id"] = resource_id
requests.post(ur... |
def get_check_and_report(client_site_url, apikey, get_resource_ids_to_check,
get_url_for_id, check_url, upsert_result):
"""Get links from the client site, check them, and post the results back.
Get resource IDs from the client site, get the URL for each resource ID from
the client ... |
def peek(self, n=1):
"""Returns buffered bytes without advancing the position."""
if n > len(self._readbuffer) - self._offset:
chunk = self.read(n)
self._offset -= len(chunk)
# Return up to 512 bytes to reduce allocation overhead for tight loops.
return self._rea... |
def read(self, n=-1):
"""Read and return up to n bytes.
If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
"""
buf = b''
while n < 0 or n is None or n > len(buf):
data = self.read1(n)
if len(data) == 0:
... |
def _RealGetContents(self):
"""Read in the table of contents for the ZIP file."""
fp = self.fp
endrec = _EndRecData(fp)
if not endrec:
raise BadZipfile("File is not a zip file")
if self.debug > 1:
print(endrec)
size_cd = endrec[_ECD_SIZE] ... |
def open(self, name, mode="r", pwd=None):
"""Return file-like object for 'name'."""
if mode not in ("r", "U", "rU"):
raise RuntimeError('open() requires mode "r", "U", or "rU"')
if not self.fp:
raise RuntimeError(
"Attempt to read ZIP archive that was alre... |
def remove(self, member):
"""Remove a member from the archive."""
# Make sure we have an info object
if isinstance(member, ZipInfo):
# 'member' is already an info object
zinfo = member
else:
# Get info object for name
zinfo = self.getinfo(m... |
def _get_codename(self, pathname, basename):
"""Return (filename, archivename) for the path.
Given a module name path, return the correct file path and
archive name, compiling if necessary. For example, given
/python/lib/string, return (/python/lib/string.pyc, string).
"""
... |
def import_class(class_path):
'''
Imports the class for the given class name.
'''
module_name, class_name = class_path.rsplit(".", 1)
module = import_module(module_name)
claz = getattr(module, class_name)
return claz |
def _executor(self):
'''
Creating an ExecutorPool is a costly operation. Executor needs to be instantiated only once.
'''
if self.EXECUTE_PARALLEL is False:
executor_path = "batch_requests.concurrent.executor.SequentialExecutor"
executor_class = import_class(e... |
def make_label(self, path):
"""
this borrows too much from the internals of ofs
maybe expose different parts of the api?
"""
from datetime import datetime
from StringIO import StringIO
path = path.lstrip("/")
bucket, label = path.split("/", 1)
buc... |
def get_proxy_config(self, headers, path):
"""
stub. this really needs to be a call to the remote
restful interface to get the appropriate host and
headers to use for this upload
"""
self.ofs.conn.add_aws_auth_header(headers, 'PUT', path)
from pprint import pprint... |
def proxy_upload(self, path, filename, content_type=None, content_encoding=None,
cb=None, num_cb=None):
"""
This is the main function that uploads. We assume the bucket
and key (== path) exists. What we do here is simple. Calculate
the headers we will need, (e.g. md5... |
def fetch_all_mood_stations(self, terr=KKBOXTerritory.TAIWAN):
'''
Fetches all mood stations.
:param terr: the current territory.
:return: API response.
:rtype: dict
See `https://docs-en.kkbox.codes/v1.1/reference#moodstations`.
'''
url = 'https://api.kk... |
def fetch_mood_station(self, station_id, terr=KKBOXTerritory.TAIWAN):
'''
Fetches a mood station by given ID.
:param station_id: the station ID
:param terr: the current territory.
:return: API response.
:rtype: dict
See `https://docs-en.kkbox.codes/v1.1/referenc... |
def fetch_next_page(self, data):
'''
Fetches next page based on previously fetched data.
Will get the next page url from data['paging']['next'].
:param data: previously fetched API response.
:type data: dict
:return: API response.
:rtype: dict
'''... |
def fetch_data(self, url):
'''
Fetches data from specific url.
:return: The response.
:rtype: dict
'''
return self.http._post_data(url, None, self.http._headers_with_access_token()) |
def fetch_shared_playlist(self, playlist_id, terr=KKBOXTerritory.TAIWAN):
'''
Fetches a shared playlist by given ID.
:param playlist_id: the playlist ID.
:type playlist_id: str
:param terr: the current territory.
:return: API response.
:rtype: dictcd
See... |
def get_firewall_rule(self, server_uuid, firewall_rule_position, server_instance=None):
"""
Return a FirewallRule object based on server uuid and rule position.
"""
url = '/server/{0}/firewall_rule/{1}'.format(server_uuid, firewall_rule_position)
res = self.get_request(url)
... |
def get_firewall_rules(self, server):
"""
Return all FirewallRule objects based on a server instance or uuid.
"""
server_uuid, server_instance = uuid_and_instance(server)
url = '/server/{0}/firewall_rule'.format(server_uuid)
res = self.get_request(url)
return [
... |
def create_firewall_rule(self, server, firewall_rule_body):
"""
Create a new firewall rule for a given server uuid.
The rule can begiven as a dict or with FirewallRule.prepare_post_body().
Returns a FirewallRule object.
"""
server_uuid, server_instance = uuid_and_instanc... |
def delete_firewall_rule(self, server_uuid, firewall_rule_position):
"""
Delete a firewall rule based on a server uuid and rule position.
"""
url = '/server/{0}/firewall_rule/{1}'.format(server_uuid, firewall_rule_position)
return self.request('DELETE', url) |
def configure_firewall(self, server, firewall_rule_bodies):
"""
Helper for calling create_firewall_rule in series for a list of firewall_rule_bodies.
"""
server_uuid, server_instance = uuid_and_instance(server)
return [
self.create_firewall_rule(server_uuid, rule)
... |
def post(self, data):
"""
POSTs a raw SMTP message to the Sinkhole API
:param data: raw content to be submitted [STRING]
:return: { list of predictions }
"""
uri = '{}/sinkhole'.format(self.client.remote)
self.logger.debug(uri)
if PYVERSION == 2:
... |
def pre_process_method_headers(method, headers):
'''
Returns the lowered method.
Capitalize headers, prepend HTTP_ and change - to _.
'''
method = method.lower()
# Standard WSGI supported headers
_wsgi_headers = ["content_length", "content_type", "query_string",
... |
def headers_to_include_from_request(curr_request):
'''
Define headers that needs to be included from the current request.
'''
return {
h: v for h, v in curr_request.META.items() if h in _settings.HEADERS_TO_INCLUDE} |
def get_wsgi_request_object(curr_request, method, url, headers, body):
'''
Based on the given request parameters, constructs and returns the WSGI request object.
'''
x_headers = headers_to_include_from_request(curr_request)
method, t_headers = pre_process_method_headers(method, headers)
# A... |
def _base_environ(self, **request):
'''
Override the default values for the wsgi environment variables.
'''
# This is a minimal valid WSGI environ dictionary, plus:
# - HTTP_COOKIE: for cookie support,
# - REMOTE_ADDR: often useful, see #8551.
# See http://www... |
def request(self, method, endpoint, body=None, timeout=-1):
"""
Perform a request with a given body to a given endpoint in UpCloud's API.
Handles errors with __error_middleware.
"""
if method not in set(['GET', 'POST', 'PUT', 'DELETE']):
raise Exception('Invalid/Forb... |
def post_request(self, endpoint, body=None, timeout=-1):
"""
Perform a POST request to a given endpoint in UpCloud's API.
"""
return self.request('POST', endpoint, body, timeout) |
def __error_middleware(self, res, res_json):
"""
Middleware that raises an exception when HTTP statuscode is an error code.
"""
if(res.status_code in [400, 401, 402, 403, 404, 405, 406, 409]):
err_dict = res_json.get('error', {})
raise UpCloudAPIError(error_code=e... |
def put_stream(self, bucket, label, stream_object, params={}):
''' Create a new file to swift object storage. '''
self.claim_bucket(bucket)
self.connection.put_object(bucket, label, stream_object,
headers=self._convert_to_meta(params)) |
def h(gbm, array_or_frame, indices_or_columns = 'all'):
"""
PURPOSE
Compute Friedman and Popescu's H statistic, in order to look for an interaction in the passed gradient-boosting
model among the variables represented by the elements of the passed array or frame and specified by the passed
indices ... |
def h_all_pairs(gbm, array_or_frame, indices_or_columns = 'all'):
"""
PURPOSE
Compute Friedman and Popescu's two-variable H statistic, in order to look for an interaction in the passed gradient-
boosting model between each pair of variables represented by the elements of the passed array or frame and s... |
def get(self, q, limit=None):
"""
Performs a search against the predict endpoint
:param q: query to be searched for [STRING]
:return: { score: [0|1] }
"""
uri = '{}/predict?q={}'.format(self.client.remote, q)
self.logger.debug(uri)
body = self.client.get... |
def exists(self, bucket, label):
'''Whether a given bucket:label object already exists.'''
fn = self._zf(bucket, label)
try:
self.z.getinfo(fn)
return True
except KeyError:
return False |
def list_labels(self, bucket):
'''List labels for the given bucket. Due to zipfiles inherent arbitrary ordering,
this is an expensive operation, as it walks the entire archive searching for individual
'buckets'
:param bucket: bucket to list labels for.
:return: iterator for the ... |
def list_buckets(self):
'''List all buckets managed by this OFS instance. Like list_labels, this also
walks the entire archive, yielding the bucketnames. A local set is retained so that
duplicates aren't returned so this will temporarily pull the entire list into memory
even though this ... |
def get_stream(self, bucket, label, as_stream=True):
'''Get a bitstream for the given bucket:label combination.
:param bucket: the bucket to use.
:return: bitstream as a file-like object
'''
if self.mode == "w":
raise OFSException("Cannot read from archive in 'w' mod... |
def get_url(self, bucket, label):
'''Get a URL that should point at the bucket:labelled resource. Aimed to aid web apps by allowing them to redirect to an open resource, rather than proxy the bitstream.
:param bucket: the bucket to use.
:param label: the label of the resource to get
:re... |
def put_stream(self, bucket, label, stream_object, params=None, replace=True, add_md=True):
'''Put a bitstream (stream_object) for the specified bucket:label identifier.
:param bucket: as standard
:param label: as standard
:param stream_object: file-like object to read from or bytestrin... |
def del_stream(self, bucket, label):
'''Delete a bitstream. This needs more testing - file deletion in a zipfile
is problematic. Alternate method is to create second zipfile without the files
in question, which is not a nice method for large zip archives.
'''
if self.exists(bucke... |
def get_metadata(self, bucket, label):
'''Get the metadata for this bucket:label identifier.
'''
if self.mode !="w":
try:
jsn = self._get_bucket_md(bucket)
except OFSFileNotFound:
# No MD found...
return {}
excep... |
def update_metadata(self, bucket, label, params):
'''Update the metadata with the provided dictionary of params.
:param parmams: dictionary of key values (json serializable).
'''
if self.mode !="r":
try:
payload = self._get_bucket_md(bucket)
excep... |
def del_metadata_keys(self, bucket, label, keys):
'''Delete the metadata corresponding to the specified keys.
'''
if self.mode !="r":
try:
payload = self._get_bucket_md(bucket)
except OFSFileNotFound:
# No MD found...
raise ... |
def get_response(wsgi_request):
'''
Given a WSGI request, makes a call to a corresponding view
function and returns the response.
'''
service_start_time = datetime.now()
# Get the view / handler for this request
view, args, kwargs = resolve(wsgi_request.path_info)
kwargs.update(... |
def get_wsgi_requests(request):
'''
For the given batch request, extract the individual requests and create
WSGIRequest object for each.
'''
valid_http_methods = ["get", "post", "put", "patch", "delete", "head", "options", "connect", "trace"]
requests = json.loads(request.body)
if t... |
def handle_batch_requests(request, *args, **kwargs):
'''
A view function to handle the overall processing of batch requests.
'''
batch_start_time = datetime.now()
try:
# Get the Individual WSGI requests.
wsgi_requests = get_wsgi_requests(request)
except BadBatchRequest as brx... |
def search(self, keyword, types=[], terr=KKBOXTerritory.TAIWAN):
'''
Searches within KKBOX's database.
:param keyword: the keyword.
:type keyword: str
:param types: the search types.
:return: list
:param terr: the current territory.
:return: API response.... |
def save(self):
"""
IPAddress can only change its PTR record. Saves the current state, PUT /ip_address/uuid.
"""
body = {'ip_address': {'ptr_record': self.ptr_record}}
data = self.cloud_manager.request('PUT', '/ip_address/' + self.address, body)
self._reset(**data['ip_add... |
def _create_ip_address_objs(ip_addresses, cloud_manager):
"""
Create IPAddress objects from API response data.
Also associates CloudManager with the objects.
"""
# ip-addresses might be provided as a flat array or as a following dict:
# {'ip_addresses': {'ip_address': [..... |
def _reset(self, **kwargs):
"""
Reset the objects attributes.
Accepts servers as either unflattened or flattened UUID strings or Server objects.
"""
super(Tag, self)._reset(**kwargs)
# backup name for changing it (look: Tag.save)
self._api_name = self.name
... |
def _get(self, uri, params={}):
"""
HTTP GET function
:param uri: REST endpoint
:param params: optional HTTP params to pass to the endpoint
:return: list of results (usually a list of dicts)
Example:
ret = cli.get('/search', params={ 'q': 'example.org' })
... |
def _post(self, uri, data):
"""
HTTP POST function
:param uri: REST endpoint to POST to
:param data: list of dicts to be passed to the endpoint
:return: list of dicts, usually will be a list of objects or id's
Example:
ret = cli.post('/indicators', { 'indica... |
def get_servers(self, populate=False, tags_has_one=None, tags_has_all=None):
"""
Return a list of (populated or unpopulated) Server instances.
- populate = False (default) => 1 API request, returns unpopulated Server instances.
- populate = True => Does 1 + n API requests (n = # of serv... |
def get_server(self, UUID):
"""
Return a (populated) Server instance.
"""
server, IPAddresses, storages = self.get_server_data(UUID)
return Server(
server,
ip_addresses=IPAddresses,
storage_devices=storages,
populated=True,
... |
def get_server_by_ip(self, ip_address):
"""
Return a (populated) Server instance by its IP.
Uses GET '/ip_address/x.x.x.x' to retrieve machine UUID using IP-address.
"""
data = self.get_request('/ip_address/{0}'.format(ip_address))
UUID = data['ip_address']['server']
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.