I started writing my own grinding bot for fun and found a nifty way to handle looting. I'm not all that good with coding, that's why small tricks like these can be very helpful. I haven't seen a post describing this trick, so here it goes.
Let's say your bot moves around and obtains a target through any means (could be TAB targetting). Your bot attacks the target, and kills it. Now you will notice that when your target dies you lose the target. You could then go search through all game objects to find the corpse, then move towards it (if needed), and use some complicated function call to loot it.
Now, the easier way goes like this:
Let's say your bot moves around and obtains a target through any means (could be TAB targetting). Your bot attacks the target, using a macro "/focus" it stores it as focus, and kills it. When your target dies, you lose your target BUT you retain your focus. A simple macro "/target focus" will target the dead mob again, you can then move to it, and if you keybind "Interact With Target", you can loot it with a simple keypress.
Edit: "Interact With Target" works also for skinning.