Python 2.8 - why does linking the image texture node throw an error?
This happens because there is no Diffuse BSDF in your material. If you create a new material with bpy.data.materials.new() it will contain only as Principle BSDF and Material Output Node. You need to create the Diffuse BSDF node first.

nodes.get("Diffuse BSDF") returns None because it can't find a node with that name. The error occurs when you try to access input[0], which as the errors says, is no attribute of NoneType.