If they only appears in the diagram an not in the semantic model (Capella model) you can use the following methods:
Diagram.get_represented_elements()
Will given you a list of DDiagramElement (Java objects at the moment, it may change in the future). Then you can use:
DDiagramElement.isVisible()
To know if the element is visible on the diagram.
AbstractDNode.getOwnedBorderedNodes()
That will give you the bordered nodes, in your case ports.
DNode.getIncomingEdges()
DNode.getOutgoingEdges()
To get edges connected to those ports.
DDiagramElement.getTarget()
To get the semantic element (CapellaElement), you can the wrap it in the corresponding Python class if needed. If the edge is computed I’m not sure what this method will return…