Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 5864772

Browse files
author
Samuel Hassine
committed
[client] Fix formatting
1 parent 45ec602 commit 5864772

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

examples/add_label_to_observable.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
# Create the observable
1313
url = opencti_api_client.stix_cyber_observable.create(
14-
observableData={
15-
"type": "url",
16-
"value": "http://johndoe.com"
17-
}
14+
observableData={"type": "url", "value": "http://johndoe.com"}
1815
)
1916
# Create the tag (if not exists)
2017
label = opencti_api_client.label.create(

examples/create_observable_relationships.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
)
2222

2323
process = opencti_api_client.stix_cyber_observable.create(
24-
observableData = {
24+
observableData={
2525
"type": "Process",
2626
"x_opencti_description": "A process",
2727
"cwd": "C:\Process.exe",
2828
"pid": "19000",
2929
"command_line": "--run exe",
30-
"x_opencti_score": 90
30+
"x_opencti_score": 90,
3131
}
3232
)
3333

@@ -45,5 +45,5 @@
4545
confidence=90,
4646
createdBy=author["id"],
4747
relationship_type="related-to",
48-
description="Relation between the File and Process objects"
49-
)
48+
description="Relation between the File and Process objects",
49+
)

examples/create_process_observable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
opencti_api_client = OpenCTIApiClient(api_url, api_token)
1111

1212
process = opencti_api_client.stix_cyber_observable.create(
13-
observableData = {
13+
observableData={
1414
"type": "Process",
1515
"x_opencti_description": "A process",
1616
"cwd": "C:\Process.exe",
1717
"pid": "19000",
1818
"command_line": "--run exe",
19-
"x_opencti_score": 90
19+
"x_opencti_score": 90,
2020
}
2121
)
2222

23-
print(process)
23+
print(process)

examples/update_observable_attributes.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,27 @@
1010
opencti_api_client = OpenCTIApiClient(api_url, api_token)
1111

1212
# Create an observable
13-
observable = opencti_api_client.stix_cyber_observable.create(
14-
observableData = {
13+
observable = opencti_api_client.stix_cyber_observable.create(
14+
observableData={
1515
"type": "file",
16-
"x_opencti_description":"A malicious file",
16+
"x_opencti_description": "A malicious file",
1717
"hashes": {
1818
"MD5": "348aefbb6142d4fff8cf26fc5dc97f8a",
1919
"SHA-1": "486e7e66c3a098c1c8f42e26c78f259d6b3108a6",
20-
"SHA-256": "42c5e1fe01e689e550ba700b3c5dd4a04a84798c1868ba53c02abcbe21491515"
20+
"SHA-256": "42c5e1fe01e689e550ba700b3c5dd4a04a84798c1868ba53c02abcbe21491515",
2121
},
22-
"x_opencti_score": "90"
23-
})
22+
"x_opencti_score": "90",
23+
}
24+
)
2425

2526
# Update the fields
2627

2728
reference = opencti_api_client.external_reference.create(
28-
source_name="Jen",
29-
url="https://janedoe.com",
30-
description="Sample Report"
29+
source_name="Jen", url="https://janedoe.com", description="Sample Report"
3130
)
3231

3332
opencti_api_client.stix_cyber_observable.add_external_reference(
34-
id=observable["id"],
35-
external_reference_id=reference["id"]
33+
id=observable["id"], external_reference_id=reference["id"]
3634
)
3735

3836
label = opencti_api_client.label.create(
@@ -41,8 +39,7 @@
4139
)
4240

4341
opencti_api_client.stix_cyber_observable.add_marking_definition(
44-
id=observable["id"],
45-
marking_definition_id=label["id"]
42+
id=observable["id"], marking_definition_id=label["id"]
4643
)
4744

4845
author = opencti_api_client.identity.create(
@@ -52,6 +49,5 @@
5249
)
5350

5451
opencti_api_client.stix_cyber_observable.update_created_by(
55-
id=observable["id"],
56-
identity_id=author["id"]
57-
)
52+
id=observable["id"], identity_id=author["id"]
53+
)

0 commit comments

Comments
 (0)