Download flight logs after the drone lands using pymavlink

I am doing autonomous missions with an onboard computer(raspberry pi zero) and pixhawk 2.4.8 on a quadcopter. I would like to download the flight logs(.tlog) file from the SD card(inserted inside pixhawk) on the pixhawk to the raspberry pi zero using pymavlink when the drone lands on the ground.
Thank you for the help