how to download a file in python using idm

import comtypes.client as cc
import comtypes

referrer = ""
cookie = ""
postData = ""
user = ""
password = ""
cc.GetModule(["{PUT_UUID_HERE}",1,0])
# not sure about the syntax here, but cc.GetModule will tell you the name of the wrapper it generated
import comtypes.gen.IDManLib as IDMan
idm1 = cc.CreateObject("IDMan.CIDMLinkTransmitter", None, None, IDMan.ICIDMLinkTransmitter2)
idm1.SendLinkToIDM("http://www.internetdownloadmanager.com/idman401.exe",
referrer, cookie, postData, user, password, r"C:\\", "idman401.exe", 0)

Here is what the above code is Doing:
1. It’s loading the COM object for IDM.
2. It’s creating an instance of the COM object.
3. It’s calling the SendLinkToIDM method of the COM object.
4. It’s passing the URL of the file to be downloaded, the referrer, the cookie, the postData, the user, the password, the path to save the file, the name of the file, and the value 0.