-
Notifications
You must be signed in to change notification settings - Fork 64
/
apifuzzerreport.py
34 lines (27 loc) · 990 Bytes
/
apifuzzerreport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import six
from kitty.data.report import Report
from apifuzzer.utils import try_b64encode
class ApifuzzerReport(Report):
def __init__(self, name):
super().__init__(name)
def is_failed(self):
"""
.. deprecated:: 0.6.7
use :func:`~kitty.data.report.Report.get_status`
"""
raise NotImplementedError('API was changed, use get_status instead')
def to_dict(self, encoding='base64'):
"""
Return a dictionary version of the report
:param encoding: required encoding for the string values (default: 'base64')
:rtype: dictionary
:return: dictionary representation of the report
"""
res = {}
for k, v in self._data_fields.items():
if isinstance(v, (bytes, bytearray, six.string_types)):
v = try_b64encode(v)
res[k] = v
for k, v in self._sub_reports.items():
res[k] = v.to_dict(encoding)
return res