#To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
URL=r"https://dl.google.com/drive-file-stream/GoogleDriveFSSetup.exe" #provide a URL 
file_path=r"C:\ProgramData\download_file"
import ctypes
import re
import time
import socket
import _winreg
import platform
import subprocess
import ssl
import urllib2
import getpass
import zipfile
import shutil
import os
def Download(src_path, URL,fp):
    import urllib2
    request = urllib2.Request(URL, headers={'User-Agent' : "Magic Browser"})
    try:
        gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
        parsed = urllib2.urlopen(request,context=gcontext)
    except:
        parsed = urllib2.urlopen(request)
    if not os.path.exists(src_path):
        os.makedirs(src_path)
    with open(fp, 'wb') as f:
        while True:
            chunk=parsed.read(100*1000*1000)
            if chunk:
                f.write(chunk)
            else:
                break
    return fp
Folder=os.environ['programdata']+r"\download_file"
if not os.path.exists(Folder):
    os.mkdir(Folder)
fileName=r"GoogleDriveFSSetup.exe"
src_path=Folder
fp = os.path.join(src_path, fileName)    
Excutable_path=Download(Folder, URL,fp)
print "Downloaded succesfully to "+Excutable_path+""



class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)

if os.path.isdir(file_path):        
    with disable_file_system_redirection():
        os.chdir(file_path)
        process= subprocess.Popen('GoogleDriveFSSetup --silent --desktop_shortcut', shell=True, stdout=subprocess.PIPE)
    result=process.communicate()
    ret=process.returncode
    if ret==0:
        print result[0]
        print "GoogleDriveFSSetup file is installed successfully"
    else:
        print result[1]
        print "GoogleDriveFSSetup file is installed with return code 1"
else:
    print '%s is not found.'%file_path
from shutil import rmtree
rmtree(file_path)    