import fiona
from wayfarer import loader, routing
recs = fiona.open("mydata.shp", "r")
net = loader.load_network(recs, key_field="osm_id")
start_node, end_node = 148267, 1890123
edges = routing.solve_shortest_path(net, start_node, end_node)
upstream_nodes_ids = ancestors(net, node_id_from)
edges = net.in_edges(nbunch=upstream_nodes_ids, data=True)