-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample_plugin_.py
More file actions
38 lines (32 loc) · 1.25 KB
/
example_plugin_.py
File metadata and controls
38 lines (32 loc) · 1.25 KB
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
35
36
37
38
from util.artifact_utils import ArtifactResult, ArtifactSpec, LogFunction, ReportPresentation, ArtifactStorage
from util.profile_folder_protocols import BrowserProfileProtocol
def example_artifact1(
profile: BrowserProfileProtocol, log_func: LogFunction, storage: ArtifactStorage) -> ArtifactResult:
log_func("Logging inside of example_artifact1")
result = ArtifactResult([
{"id": rec.rec_id, "title": rec.title, "url": rec.url} for rec in profile.history.iter_history_records(None)
])
return result
def example_artifact2(
profile: BrowserProfileProtocol, log_func: LogFunction, storage: ArtifactStorage) -> ArtifactResult:
log_func("Logging inside of example_artifact2")
result = ArtifactResult([{"host": rec} for rec in profile.iter_local_storage_hosts()])
return result
__artifacts__ = (
ArtifactSpec(
"Examples",
"Example artifact 1",
"Example which returns all Titles and URLs from history",
"0.0.3",
example_artifact1,
ReportPresentation.table
),
ArtifactSpec(
"Examples",
"Example artifact 2",
"Example which returns all hosts for local storage",
"0.0.2",
example_artifact2,
ReportPresentation.table
)
)