It's definitely possible.
Python could run Spine to do the export with the CLI. Doesn't get much easier than that.
Export - Spine User Guide: Command line
Otherwise, you'll need to render your skeleton to a buffer instead of the screen, then write the buffer as an image file. If your game toolkit uses OpenGL, this is done by rendering to a frame buffer object (FBO) instead of to the screen. Searching for FBO might help. Other game toolkits may be able to render directly to a buffer in memory.
Once you have the image data, you need to write it to a file. You might start by writing a single frame as a PNG or BMP. How you write an image file depends on the libraries you use.
To write a GIF you'll need to pose your skeleton with an animation, render a frame to a buffer, write that buffer to the GIF, increment the animation time, pose the skeleton at the new time, render to a buffer, etc until you've rendered all the frames to the GIF. Alternatively you could write PNG files and assemble them into a GIF using a tool like gifski or imagemagick.
BonePlotting is a simple Java app that shows how to pose the skeleton for each frame. It doesn't render to a buffer or write images files though.
I'm afraid I'm not a Python guy, so I can't give any recommendations for how to do what you need. I could help more if you wanted to use libgdx. 🙂