How to get a list of used resources via python?
You should be check and use the API... in this case the data

https://www.blender.org/api/blender_python_api_current/bpy.data.html

https://www.blender.org/api/blender_python_api_current/bpy.types.BlendData.html#bpy.types.BlendData

import bpy

d = bpy.data

## example for textures
textures =  d.textures

for texture in textures:
    print(texture.name)

#example for materials

materials = d.materials

for material in materials:
    print(material.name)