Code Documentation

Blockade Analyst Bench Interface

class blockade.api.Client(email, api_key, server='api.blockade.io', http_proxy=None, https_proxy=None, verify=True, headers=None, debug=False)[source]

Base client that all data sources will inherit from.

_endpoint(endpoint, action, *url_args)[source]

Return the URL for the action.

Parameters:
  • endpoint (str) – The controller
  • action (str) – The action provided by the controller
  • url_args – Additional endpoints(for endpoints that take part of the url as option)
Returns:

Full URL for the requested action

_get(endpoint, action, *url_args, **url_params)[source]

Request API Endpoint - for GET methods.

Parameters:
  • endpoint (str) – Endpoint
  • action (str) – Endpoint Action
  • url_args – Additional endpoints(for endpoints that take part of the url as option)
  • url_params – Parameters to pass to url, typically query string
Returns:

response deserialized from JSON

_json(response)[source]

JSON response from server.

Parameters:response – Response from the server
Throws ValueError:
 from requests’ response.json() error
Returns:response deserialized from JSON
_send_data(method, endpoint, action, data, *url_args, **url_params)[source]

Submit to API Endpoint - for DELETE, PUT, POST methods.

Parameters:
  • method (str) – Method to use for the request
  • endpoint (str) – Endpoint
  • action (str) – Endpoint Action
  • url_args – Additional endpoints(for endpoints that take part of the url as option)
  • url_params – Parameters to pass to url, typically query string
Returns:

response deserialized from JSON

classmethod from_config()[source]

Method to return back a loaded instance.

set_debug(status)[source]

Control the logging state.

class blockade.config.Config(**kwargs)[source]

Manage configuration to ease library use.

get(item, default=None)[source]

Get details from the configuration.

Parameters:
  • item (str) – Key used for search
  • default – Default value if search misses
Returns:

Configuration value

load_config(**kwargs)[source]

Load the configuration for the user or seed it with defaults.

Returns:Boolean if successful
options

Return configuration option data.

Returns:Dict of configuration keys
write_config()[source]

Write the configuration to a local file.

Returns:Boolean if successful
class blockade.libs.events.EventsClient(*args, **kwargs)[source]

Client to interface with events for blockade.

flush_events()[source]

Flush events from the cloud node.

get_events()[source]

Get events from the cloud node.

class blockade.libs.indicators.IndicatorClient(*args, **kwargs)[source]

Client to interface with indicators for blockade.

add_indicators(indicators=[], private=False, tags=[])[source]

Add indicators to the remote instance.

get_indicators()[source]

List indicators available on the remote instance.