#To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
path_shortcut="C:\ProgramData\extraction_file"			
URL=r"https://docs.google.com/uc?export=download&id=1gWkN3tm2P5AO_CVR1ktwB9qv46qoxPVJ" #provide a URL of 32 bit package
import ctypes
import re
import time
import socket
import _winreg
import platform
import shutil
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"\extraction_file"
if not os.path.exists(Folder):
    os.mkdir(Folder)
fileName=r"cpuz.zip"
src_path=Folder
fp = os.path.join(src_path, fileName)    
Excutable_path=Download(Folder, URL,fp)
#print "Downloaded succesfully to "+Excutable_path+""
dest_path="C:\ProgramData\extraction_file"
def filezip(Excutable_path,dest_path):
    with zipfile.ZipFile(Excutable_path,"r") as zip_ref:
        zip_ref.extractall(dest_path)
        #print 'file unzipped to ' +dest_path 
filezip(Excutable_path,dest_path)

os.chdir(dest_path)
arch=os.popen("wmic os get osarchitecture").read()
if '64' in arch:
    os.popen("cpuz_x64.exe -txt="+dest_path+"\\"+"out").read()
else:
    os.popen("cpuz_x32.exe -txt="+dest_path+"\\"+"out").read()

with open(dest_path+'\\out.txt') as f:
    lines = f.read()
rtypes=re.findall("Memory Type\s+DDR\d",lines)
if not rtypes:
    print "Memory Type : Data Undefined"
else:
    Memory_Type=re.findall("Memory Type\s+DDR\d",lines)[0].split()[2]
    print "Memory Type :"+Memory_Type

strings=os.popen("systeminfo").read()
memory_size=re.findall("Total Physical Memory:\s+\d+.\d+\s+\w+",strings)
if memory_size:
    a=memory_size[0].split()[-2:]
    print "Memory Size :"+(" ").join(i for i in a)
else:
    print "Memory Size : Data Undefined"

bank_label=os.popen("wmic MEMORYCHIP get BankLabel, Speed").read()
if bank_label.strip():
    print "Memory Bandwidth :" +bank_label.split()[-1]+" Mhz"
else:
    print "Memory Bandwidth : Data Undefined"
chn=re.findall("Channels\s+\w+",lines)    
if not chn:
    print "Channels : Data Undefined"
else: 
    channel=re.findall("Channels\s+\w+",lines)[0].split()[1]
    print "Channel : "+channel
