How do I edit an image node in blender using python
To get a material by its name:

mat = bpy.data.materials[ mat_name ]


To get a node in it by its name:

node = mat.node_tree.nodes[ node_name ]


To get all the image texture nodes in a material:

nodes = [n for n in mat.node_tree.nodes if n.type == 'TEX_IMAGE']




For the image part, I presume it is loaded and exist in Blender.

If yes, to get it from its name:

image = bpy.data.images[ image_name ]


If no, you can load it:

bpy.data.images.load( filepath )




Setting an image in a image texture node:

image_node.image = image


where 'image_node' is one of the nodes obtained as 'TEX_IMAGE' above.

and where 'image' is the object obtained from bpy.data.images