-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_filler.py
More file actions
executable file
·117 lines (106 loc) · 2.71 KB
/
Copy pathdb_filler.py
File metadata and controls
executable file
·117 lines (106 loc) · 2.71 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/python3
import requests
BACKEND_URL = "http://192.168.30.238:8682"
BUCKETS = [
{
"name": "Bucket A for Storing",
"description": "Bucket A for Andrew for storing",
"amount": 500000,
"variant": {
"type": "STORE"
}
},
{
"name": "Bucket B is invisible",
"description": "Bucket b for Bandrew but invisble",
"amount": 200000,
"variant": {
"type": "INVSB"
}
},
{
"name": "Bucket C is Goals",
"description": "Bucket c for Candrew for Goals",
"amount": 100000,
"variant": {
"type": "GOALS",
"target": 500000
}
}
]
EVENTS = [
{
"name": "A to B",
"description": "Moving Money from A to B",
"bucket_id": 1,
"trigger": {
"type": "timed",
"frequency": "3m",
"next_trigger_date": "2025-03-15T10:24:42.687Z"
},
"operation": {
"to_bucket_id": 2,
"type": "MOVE",
"amount": 12300
}
},
{
"name": "Add Money to A",
"description": "Adding Money to A",
"bucket_id": 1,
"trigger": {
"type": "timed",
"frequency": "1m",
"next_trigger_date": "2025-04-20T10:24:42.687Z"
},
"operation": {
"type": "ADD",
"amount": 55500
}
},
{
"name": "Subtract Money from B",
"description": "Subtracting Money from B",
"bucket_id": 2,
"trigger": {
"type": "timed",
"frequency": "2m",
"next_trigger_date": "2025-05-25T10:24:42.687Z"
},
"operation": {
"type": "SUB",
"amount": 11100
}
},
{
"name": "Add Money to C",
"description": "Adding Money from C",
"bucket_id": 2,
"trigger": {
"type": "timed",
"frequency": "10m",
"next_trigger_date": "2025-01-10T10:24:42.687Z"
},
"operation": {
"type": "ADD",
"amount": 22200
}
}
]
def post_event(event):
print(f"ADDING EVENT: {event}")
try:
requests.post(f"{BACKEND_URL}/api/v1/event", json=event)
except Exception as e:
(f"ERROR for Event: {event} - Error: {e}")
def post_bucket(bucket):
print(f"ADDING BUCKET: {bucket}")
try:
requests.post(f"{BACKEND_URL}/api/v1/bucket", json=bucket)
except Exception as e:
print(f"ERROR for bucket: {bucket} - Error: {e}")
if __name__ == "__main__":
for bucket in BUCKETS:
post_bucket(bucket)
for event in EVENTS:
post_event(event)