How can i find the python triggered by the GUI?
The API documentation should be your primary reference when implementing Python scripts for Blender.

Additionally you can enable the Python Tooltips and Developer Extras in the preferences (Edit > Preferences > Interface > Display). 



The Python Tooltips will be displayed when hovering over a UI element with your mouse and show what Python command would be executed when interacting with it. The Developer Extras add helpful options such as Edit Source or Online Python Reference to the context menu (RMB).







Using the references provided above it's fairly easy to see why your script doesn't work properly.

bpy.ops.import_scene.gltf() expects a file path as argument, not a file object. Therefore you shouldn't use open() at all. Instead pass the file path as named argument: 

bpy.ops.import_scene.gltf(filepath="/path/to/your/file")