Skip to content

Commit 729f630

Browse files
committed
Polishing
1 parent 0e72288 commit 729f630

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

functions/hello/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from falconfoundry import FoundryFunction, FoundryRequest, FoundryResponse, FoundryAPIError
22

3+
34
func = FoundryFunction.instance()
45

56

functions/log-event/main.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ def on_post(request: FoundryRequest) -> FoundryResponse:
2020
try:
2121
# Store data in a collection
2222
# This assumes you've already created a collection named "event_logs"
23-
json={
23+
json = {
2424
"data": event_data,
2525
"timestamp": int(time.time())
2626
}
2727

2828
falcon = CustomStorage()
2929

30-
response = falcon.PutObject(body=json,
30+
response = falcon.PutObject(body=json,
3131
collection_name="event_logs",
3232
object_key="event_id"
3333
)
3434

3535
if response.status_code != 201:
3636
return FoundryResponse(
37-
code=create_response.status_code,
37+
code=response.status_code,
3838
errors=[FoundryAPIError(
39-
code=create_response.status_code,
40-
message=f"Failed to store event: {create_response.text}"
39+
code=response.status_code,
40+
message=f"Failed to store event: {response.text}"
4141
)]
4242
)
4343

@@ -51,7 +51,7 @@ def on_post(request: FoundryRequest) -> FoundryResponse:
5151
return FoundryResponse(
5252
body={
5353
"stored": True,
54-
"record_id": create_response.json().get("id"),
54+
"record_id": response.json().get("id"),
5555
"recent_events": query_response.json().get("resources", [])
5656
},
5757
code=200
@@ -61,3 +61,7 @@ def on_post(request: FoundryRequest) -> FoundryResponse:
6161
code=500,
6262
errors=[FoundryAPIError(code=500, message=f"Error with collection: {str(e)}")]
6363
)
64+
65+
66+
if __name__ == '__main__':
67+
func.run()

functions/servicenow/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from falconpy import APIIntegrations
33
import logging
44

5+
56
func = FoundryFunction.instance()
67

78
# This configuration for logging will only work when running locally

0 commit comments

Comments
 (0)