How do I export non-face edges with Blender's Python API?
I'm not familiar with a direct method to get the list of free-edges (not comprising faces), but you can find them using this script:

import bpy, bmesh

o = bpy.context.object
bm = bmesh.new()
bm.from_mesh( o.data )

faceEdges = set( [ e.index for f in bm.faces for e in f.edges ] )
allEdges  = set( range( len( bm.edges ) ) )
freeEdges = allEdges.difference( faceEdges )

print( "Indices of non face edges: ", freeEdges )