Ejemplo n.º 1
0
def writeStats():
    fileName = "Resources\\stats"
    f = open(config.get_main_dir() + "\\" + fileName, "wb")
    print>>f, str(config.totalGames)
    print>>f, str(config.gamesWon)
    print>>f, str(config.gamesLost)
    f.close()
Ejemplo n.º 2
0
def readStats():
    fileName = "Resources\\stats"
    f = open(config.get_main_dir() + "\\" + fileName)
    config.totalGames = int(f.readline())
    config.gamesWon = int(f.readline())
    config.gamesLost = int(f.readline())
    f.close()
Ejemplo n.º 3
0
def generate_xls(Con):
    wb = Workbook()
    ws = wb.add_sheet(sheetname='Order Results')
    headerStyle = easyxf('font: bold True')
    wrapStyle = easyxf('alignment: wrap True')
    ws.write(0, 0, 'Date', headerStyle)
    ws.write(0, 1, 'Particulars', headerStyle)
    ws.write(0, 2, 'Amount', headerStyle)
    ws.write(0, 3, 'Revenue', headerStyle)
    max_width_col0 = 0
    max_width_col1 = 0
    i = 1
    for order in Con.Orders:
        ws.write(i, 0, order.orderDate)
        ws.write(i, 1, order.Particulars, wrapStyle)
        ws.write(i, 2, float(order.Total_Amount))
        ws.write(i, 3, float(order.Revenue_Amount))
        for s in order.Particulars.split('\n'):
            if max_width_col1 < len(s):
                max_width_col1 = len(s)

        if max_width_col0 < len(str(order.orderDate)):
            max_width_col0 = len(str(order.orderDate))
        i += 1

    ws.col(1).width = 256 * max_width_col1 + 2
    ws.col(0).width = 256 * max_width_col0 + 20
    ws.write(i, 1, 'Total Amount', headerStyle)
    ws.write(i, 2, Con.Total_Amount, headerStyle)
    ws.write(i, 3, Con.Revenue_Amount, headerStyle)
    filename = Con.Username + '_' + Con.Label + '_'
    filename += Con.FromDate.strftime('%Y%m%d') + '_'
    filename += Con.ToDate.strftime('%Y%m%d') + '.xls'
    wb.save(config.get_main_dir() + '/Output/' + filename)
def browseOutputPath(evt):
    from gui import dialog

    outputPath = dialog.choose_directory(message="Choose the outoput directory",
                                         path=config.get_main_dir() + "/Output/")

    if outputPath is not None:
        mywin['txtOutputPath'].value = outputPath
Ejemplo n.º 5
0
def setup_driver():
    dcap = dict(webdriver.DesiredCapabilities.PHANTOMJS)
    dcap["phantomjs.page.settings.userAgent"] = (
        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36")
    service_args = ['--load-images=false', '--proxy-type=none', '--ignore-ssl-errors=true']
    phantomBinary = config.get_main_dir() + "\\Resources\\phantomjs.exe"
    config.driver = webdriver.PhantomJS(
        executable_path=phantomBinary, service_args=service_args, desired_capabilities=dcap)
def readProperties():
    Config = ConfigParser()
    fileName = 'Resources\properties.ini'
    Config.read(config.get_main_dir() + "\\" + fileName)
    config.Email = Config.get('Information', 'Email').strip()
    config.Password = Config.get('Information', 'Password').strip()
    config.Keyword = Config.get('Information', 'Keyword').strip()
    config.Size = Config.get('Information', 'Size').strip()

    config.ProxyIP = Config.get('Information', 'ProxyIP').strip()
Ejemplo n.º 7
0
    def __init__(self):
        # ffProfile = FirefoxProfile()
        # ffProfile.set_preference('permissions.default.image', 2)
        # self.driver = webdriver.Firefox(ffProfile)

        service_args = ['--load-images=false', '--ignore-ssl-errors=true', '--proxy-type=none']
        phantomBinary = config.get_main_dir() + "\\Resources\\phantomjs.exe"
        dcap = dict(webdriver.DesiredCapabilities.PHANTOMJS)
        dcap["phantomjs.page.settings.userAgent"] = ("Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36")
        self.driver = webdriver.PhantomJS(executable_path=phantomBinary, desired_capabilities=dcap, service_args=service_args)
        self.driver.implicitly_wait(10)
Ejemplo n.º 8
0
 def CreateMyToolbar(self):
     path=config.get_main_dir()
     exitfile=os.path.join(path,'img','exit.png')
     configfile=os.path.join(path,'img','config.png')
     aboutfile=os.path.join(path,'img','about.png')
     toolbar = self.CreateToolBar()
     self.toolExit=wx.NewId()
     self.toolConfig=wx.NewId()
     self.toolAbout=wx.NewId()
     toolbar.AddLabelTool(self.toolExit, 'Exit', wx.Bitmap(os.path.join(path,'img','exit.png')))
     toolbar.AddLabelTool(self.toolConfig, 'Config', wx.Bitmap(os.path.join(path,'img','config.png')))
     toolbar.AddLabelTool(self.toolAbout, 'About', wx.Bitmap(os.path.join(path,'img','about.png')))
     toolbar.Realize()
Ejemplo n.º 9
0
def writeScrapedOrders():
    f = None
    try:
        fileName = "Resources\\scrapedOrders.txt"
        f = open(config.get_main_dir() + "\\" + fileName, "wb")
        for orderNum in config.ScrapedOrders:
            print>>f, orderNum
        f.close()
    except:
        logger.exception(sys.exc_info())
    finally:
        if f:
            f.close()
Ejemplo n.º 10
0
    def __init__(self, ProxyIP):
        # ffProfile = FirefoxProfile()
        # ffProfile.set_preference('permissions.default.image', 2)
        # proxySettings = Proxy({
        #     'proxyType': 'MANUAL',
        #     'httpProxy': ProxyIP,
        #     'ftpProxy': ProxyIP,
        #     'sslProxy': ProxyIP
        # })

        # self.driver = webdriver.Firefox(ffProfile, proxy=proxySettings)
        # self.driver = webdriver.Firefox(ffProfile)
        # self.driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.HTMLUNIT, proxy=proxySettings)

        #self.driver = webdriver.Firefox(proxy=proxySettings)

        dcap = dict(webdriver.DesiredCapabilities.PHANTOMJS)
        proxyArg = '--proxy=' + str(ProxyIP)
        dcap["phantomjs.page.settings.userAgent"] = (
            "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36")
        service_args = ['--load-images=false', '--proxy-type=http', proxyArg, '--ignore-ssl-errors=true']
        phantomBinary = config.get_main_dir() + "\\Resources\\phantomjs.exe"
        self.driver = webdriver.PhantomJS(executable_path=phantomBinary, service_args=service_args,
                                          desired_capabilities=dcap)
Ejemplo n.º 11
0
# Embedded file name: Utilities\myLogger.pyo
import logging
import config
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M', filename=config.get_main_dir() + 'logger.log', filemode='w')
logger = logging.getLogger('MainLogs')
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('logger.log')
fh.setLevel(logging.ERROR)
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
logger.addHandler(ch)
Ejemplo n.º 12
0
def readScrapedOrders():
    fileName = "Resources\\scrapedOrders.txt"
    f = open(config.get_main_dir() + "\\" + fileName)
    for line in f.readlines():
        config.ScrapedOrders.append(line.rstrip('\n'))
    f.close()
import logging
import config

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt='%m-%d %H:%M',
                    filename=config.get_main_dir() + '/Resources/logger.log',
                    filemode='w', )
logger = logging.getLogger('MainLogs')
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('logger.log')
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger.addHandler(ch)
def setDefaultOutputDir(evt):
    mywin['txtOutputDir'].value = config.get_main_dir() + "\\Output"
Ejemplo n.º 15
0
#!/usr/bin/env python3.0
## 08-July-2010, by Yuesheng Qi
## Update: from http to https

import socket, ssl
from time import sleep 
import sys,os

## constant variable defines
##import configuration_loader
##filepath = configuration_loader.ATE_Config.get("MAIN_PATH")+"/dongle/functional_suite/workspace/"
import config
filepath = config.get_main_dir()
#"/home/buildbot/dongle/functional_suite/workspace/"
global PrivateKeyFile, CertificateChainfile
PrivateKeyFile = os.path.join(filepath, 'privatekey.pem')
CertificateChainFile = os.path.join(filepath, 'certchain.pem')

HTTP_COMMAND_HEADER = ('POST / HTTP/1.1\r\n'
        + 'User-Agent: Morega PC Client\r\n'
        + 'Authorization: Basic YWRtaW5pc3RyYXRvcjphZG1pbmlzdHJhdG9y\r\n'
        + 'Pragma: no-cache\r\n'
        + 'Content-Type: application/x-www-form-urlencoded\r\n')

HTTP_COMMAND_CONTENT_LENGTH = "Content-Length: "

HTTP_COMMAND_HEADER_TERMINATOR = '\r\n'
python_version= sys.version[:3]

class ENUM_STATE :
    START = 0

    except:
        logger.exception(sys.exc_info())
    finally:
        mywin.minimized = False


# --- gui2py designer generated code starts ---

#======== MAIN WINDOW ========#
gui.Window(name=u'Fiverr_OrderScrape',
           title=u'Fiverr Order Scraping Tool',
           maximize_box=False, resizable=False, height='400px', left='173',
           top='58', width='550px', bgcolor=u'#E0E0E0', fgcolor=u'#000000',
           image=config.get_main_dir()+'/Resources/tile.bmp', tiled=True, )

#======== HEADER LABELS ========#
gui.Label(id=281, name='label_211_281', height='17', left='50', top='40',
          width='254', transparent=True,
          font={'size': 9, 'family': 'sans serif', 'face': u'Arial'},
          parent=u'Fiverr_OrderScrape',
          text=u'Welcome to Fiverr Order Scrape Tool', )

gui.Label(id=1001, name='label_1001', height='17', left='50', top='80',
          width='131', parent=u'Fiverr_OrderScrape',
          text=u'Fiverr Username:'******'txtFivUsername', height='23', left='160',
            sizer_align='center', top='80', width='150', bgcolor=u'#FFFFFF',
            editable=True, enabled=True, fgcolor=u'#000000',
def setDefaultOutputPaths(evt):
    fileName = "Output\\"
    outputPath = config.get_main_dir() + "\\" + fileName
    mywin['txtOutputPath'].value = outputPath
Ejemplo n.º 18
0
import logging
import config

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt='%m-%d %H:%M',
                    filename=config.get_main_dir() + '/Resources/logger.log',
                    filemode='w', )
logger = logging.getLogger('AdRenewalLogs')
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('logger.log')
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
logger.addHandler(ch)
        elif ret_value == "NO_RESULTS":
            gui.alert("Your search query returned zero results !!!")
        else:
            gui.alert("There were some problems with the scraping. Please report to developer.")
    except:
        logger.exception(sys.exc_info())
    finally:
        mywin.minimized = False
    pass

# --- gui2py designer generated code starts ---

#======== MAIN WINDOW ========#
gui.Window(name=u'Scrape_Tool', title=u'Bedrijvengids-belgie.be Scraping Tool', aximize_box=False,
           resizable=False, height='400px', left='173', top='58', width='550px', bgcolor=u'#E0E0E0', fgcolor=u'#000000',
           image=config.get_main_dir() + '/Resources/tile.bmp', tiled=True, )

#======== HEADER LABELS ========#
gui.Label(id=281, name='label_211_281', height='17', left='50', top='40', width='254', transparent=True,
          font={'size': 9, 'family': 'sans serif', 'face': u'Arial'}, parent=u'Scrape_Tool',
          text=u'Welcome to Bedrijvengids-belgie.be Scraping Tool', )

gui.Label(id=1001, name='label_1001', height='17', left='50', top='80', width='131', parent=u'Scrape_Tool',
          text=u'Arrondissement:', transparent=True, )

gui.ComboBox(id=1003, name=u'cboArrondissement', height='23', left='170', sizer_align='center', top='80', width='250',
             bgcolor=u'#FFFFFF', editable=True, enabled=True, fgcolor=u'#000000', parent=u'Scrape_Tool',
             transparent=True, readonly=True, items=arrondissement_list)

gui.Label(id=1002, name='label_1002', height='17', left='50', top='120', width='131', parent=u'Scrape_Tool',
          text=u'Naam', transparent=True, )