Using python to animate a curve FModifier
You have to specify a particular animation channel (fcurve) and a specific modifier. In this example I access the first fcurve in the fcurve list ([0]), which, because I animated the location of my object is the 'x' channel, and the first modifier ([0]) found on that fcurve: 

ob = bpy.data.objects['Cube']
ob.animation_data.action.fcurves[0].modifiers[0].influence = 0


Because you have two modifiers on your fcurve it will be modifiers[1]. 

A good way to explore the Blender Python API is to use the 'autocomplete' feature of Blender's Python console, which allows you to type part of a command, and using the autocomplete feature, view all possible sub-modules (in green):



This may not necessarily show you exactly which option you need, but will at least list the possible options, which you can further research.

Whether your current logic will do what you want, I don't know, but this does address what seemed to be the main point of your question.