OpenCTI-Platform / client-python

OpenCTI Python Client
https://www.opencti.io
Apache License 2.0
111 stars 127 forks source link

Allow from_or_to_id to get relationship #739

Closed DucNg closed 2 days ago

DucNg commented 6 days ago

Proposed changes

Checklist

Further comments

I guess it's a programming oversight not to allow read using from_or_to_id since it works just by adding this condition. I'm open to adding a test case for this change but I wasn't able to find a proper example with fixtures.

How to test

import pycti

OPENCTI_URL = "http://localhost:8080"
OPENCTI_TOKEN = "<token>"
opencti_client = pycti.OpenCTIApiClient(OPENCTI_URL, OPENCTI_TOKEN)
toto = opencti_client.stix_core_relationship.read(
    fromOrToId="<id of an element with a relationship>"
)
print(toto)
DucNg commented 2 days ago

Should be done using list(): https://filigran-community.slack.com/archives/C06CC3T5Z37/p1727687428380199