Skip to content

Commit

Permalink
lazy template and 's/_/ /g response.content'
Browse files Browse the repository at this point in the history
  • Loading branch information
ak committed Jul 11, 2014
1 parent e18548a commit dda7eb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion opendns_service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class OpenDNSService(Service):
name = "opendns_investigate"
version = '1.0.0'
type_ = Service.TYPE_CUSTOM
template = "opendns_service_template.html"
supported_types = [ 'Domain', 'IP' ]
required_fields = []
default_config = [
Expand All @@ -28,6 +29,9 @@ class OpenDNSService(Service):
private=True),
]

def _replace(self, string):
return string.replace("_", " ")

def _scan(self, context):
token = self.config.get('Investigate_API_Token', '')
uri = self.config.get('Investigate_URI', '')
Expand Down Expand Up @@ -72,7 +76,7 @@ def _scan(self, context):
self._error("Request: %s, error, %s" % (r, resp.reason))
resps[r] = "Request: %s, error, %s" % (r, resp.reason)
else:
resps[r] = json.loads(resp.content)
resps[r] = json.loads(self._replace(resp.content))

except Exception as e:
logger.error("Network connection or HTTP request error (%s)" % e)
Expand Down
6 changes: 6 additions & 0 deletions opendns_service/templates/opendns_service_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% include 'services_results_default.html' %}
<style>
.chart {
table-layout: fixed;
}
</style>

0 comments on commit dda7eb7

Please sign in to comment.