Unfortunately the current Python API (2017.2) does not have an 'Analysis' object that you can interact with. Fortunately the next version (2018) will have such an object BUT I just checked it and it doesn't include contact incidents.. I logged a defect report about that so hopefully that gets sorted out soon.
I've made two simple Python functions that might be a starting point for you here. There IS an error about flex bodies not existing that should be cleaned up, but this is an example to start with.. Put the example file in your Adams working directory and do: