forked from DevoInc/python-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_providers_example.py
More file actions
29 lines (22 loc) · 878 Bytes
/
custom_providers_example.py
File metadata and controls
29 lines (22 loc) · 878 Bytes
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
from devoutils.faker import SyslogFakeGenerator
import random
from devo.sender import Sender
def get_choices():
return ["Failed", "Success", "Totally broken", "404", "500", "What?"]
if __name__ == "__main__":
with open("./custom_providers_template.jinja2", 'r') as myfile:
template = myfile.read()
con = None
# This example need a sender con
# Example
# con = Sender(config="./config.yaml")
custom = {"random": random, "choices": get_choices}
# If you remove simulation or set to false, data will be send
f = SyslogFakeGenerator(engine=con,
template=template,
simulation=True,
probability=80,
frequency=(0.1, 3),
providers=custom,
verbose=True)
f.start()