当前位置: 首页>>代码示例>>Python>>正文


Python OrangeGbl.log方法代码示例

本文整理汇总了Python中OrangeGbl.log方法的典型用法代码示例。如果您正苦于以下问题:Python OrangeGbl.log方法的具体用法?Python OrangeGbl.log怎么用?Python OrangeGbl.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OrangeGbl的用法示例。


在下文中一共展示了OrangeGbl.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: NextpageDuespaghi

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def NextpageDuespaghi(url, page):
    if gL.trace: gL.log(gL.DEBUG)   
    
    try: 
        #   DUESPAGHI - PAGINAZIONE - RICEVE UNA PAGINA, E RESTITUISCE URL DELLA NEXT
        o = urlparse(url)
        found = re.search('pag=(.+?)&', o.query).group(1)
        if found is not None:
            # l'url della paginazione
            nx = int(found) + 1
            url_a = "http://" + o.hostname + o.path + "?pag=" + str(nx) + "&ord=relevance&dir=desc"
        # controlla che esista
        rc, page = ReadPage(url_a)
        if rc != 0 or page is None:            
            return False, ''
        #chkstr = '//*[@class="row-identity-container"]/a/@href'
        chkstr = '//*[@class="disabled"]//i//@class' # Element='<i class="fa fa-chevron-right" />'
        test = page.xpath(chkstr)  # le pagine esistono ma non hanno contenuto
        if "fa fa-chevron-right" not in test:
            return url_a, page

    except Exception as err:
        url_a = "http://" + o.hostname + o.path + "?pag=2&ord=relevance&dir=desc"  # se non trovo il numero pagina vuol dire che è la prima pagina, 
        # controlla che esista
        rc, newpage = ReadPage(url_a)
        if rc == 0 and newpage is not None:
            test = newpage.xpath('//*[@class="row-identity-container"]/a/@href')  # controllo che la seconda esista con del contenuto
            if test:
                return url_a, newpage
            else:
                return False, ''

    return False, ''
开发者ID:micheledalonzo,项目名称:Orange,代码行数:35,代码来源:OrangeParse.py

示例2: dbAssetPrice

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def dbAssetPrice(Asset, PriceList, currency):
    if gL.trace: gL.log(gL.DEBUG)   
    try:     
        # cancella e riscrive la classificazione dell'asset  
        if len(PriceList)>0:                
            PriceCurr = ""
            PriceFrom = 0
            PriceTo = 0
            PriceAvg = 0
            for i in PriceList:
                if i[0] == 'PriceCurr':
                    PriceCurr = i[1]
                if i[0] == 'PriceFrom':
                    PriceFrom = i[1]
                if i[0] == 'PriceTo':
                    PriceTo = i[1]
                if i[0] == 'PriceAvg':
                    PriceAvg = i[1]
            if PriceCurr == '':
                PriceCurr = currency
            if PriceFrom == 0 and PriceTo == 0 and PriceAvg == 0:
                pass
            else:
                gL.cMySql.execute("Delete from AssetPrice where Asset = %s ", ([Asset]))
                gL.cMySql.execute("Insert into AssetPrice(Asset, PriceCurrency, PriceFrom, PriceTo, PriceAvg) Values (%s, %s, %s, %s, %s)", (Asset, PriceCurr, PriceFrom, PriceTo, PriceAvg))
        return True

    except Exception as err:
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:32,代码来源:OrangeDb.py

示例3: OpenConnectionSqlite

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def OpenConnectionSqlite():
    if gL.trace: gL.log(gL.DEBUG)   
    if not gL.SqLite:
        gL.SqLite = sqlite3.connect(':memory:')
        gL.cLite = gL.SqLite.cursor()
    
    return gL.SqLite, gL.cLite
开发者ID:micheledalonzo,项目名称:Orange,代码行数:9,代码来源:OrangeDb.py

示例4: QueueViamichelin

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def QueueViamichelin(country, assettype, source, starturl, pageurl, page):
    if gL.trace: gL.log(gL.DEBUG)   
    try:

        #lista = page.xpath('//a[@class="clearfix"]')  # funziona
        href = page.xpath('//a[@class="parseHref jsNodePoiLink"]//@href')
        test = page.xpath('//h2[@class="parseInnerText jsNodePoiTitle"]//text()')
        # togli i nomi vuoti
        nomi = []
        for item in test:
            if item.replace(" ","") != '':
                nomi.append(item)
        if len(nomi) > len(href):
            msg ="%s - %s" % ("Errore nel parsing dei nomi o di href", url)
            gL.log(gL.ERROR, msg)
            return False
        if nomi is None or href is None:
            msg ="%s - %s" % ("Parsing dei nomi / href senza risultati", url)
            gL.log(gL.ERROR, msg)
            return False
        n = 0
        for asset in nomi:        
            if not href[n]:
                continue 
            name = gL.StdName(nomi[n])        
            url  = gL.SourceBaseUrl + href[n]               
            rc = gL.dbEnqueue(country, assettype, source, starturl, pageurl, url, name)
            n = n + 1  # next asset

    except Exception as err:
        gL.log(gL.ERROR, pageurl)
        gL.log(gL.ERROR, err)
        return False
    
    return True
开发者ID:micheledalonzo,项目名称:Orange,代码行数:37,代码来源:OrangeParse.py

示例5: UpdDriveRun

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def UpdDriveRun(startend):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        if startend == "START":
            gL.cMySql.execute("Update Drive set RunDate = %s where active = True", ([gL.RunDate]))
        if startend == "END":        
            gL.cMySql.execute("Update Drive set RunDate_end = %s where active = True", ([gL.SetNow()]))    
    except Exception as err:        
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:12,代码来源:OrangeDb.py

示例6: ParseAsset

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def ParseAsset(country, assettype, source, starturl, pageurl, asseturl, name):
    if gL.trace: gL.log(gL.DEBUG)   
    # parse delle singole pagine degli asset
    gL.dbQueueStatus("START", country, assettype, source, starturl, pageurl, asseturl) # scrivo nella coda che inizio
    Asset = gL.ParseContent(country, assettype, source, starturl, asseturl, name)                           
    if Asset:  # se tutto ok
        gL.dbQueueStatus("END", country, assettype, source, starturl, pageurl, asseturl) # scrivo nella coda che ho finito
    else:
        return False                                           
    return True
开发者ID:micheledalonzo,项目名称:Orange,代码行数:12,代码来源:Parse.py

示例7: RunIdCreate

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def RunIdCreate(RunType):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        runid = 0
        gL.cMySql.execute("Insert into Run (Start, RunType) Values (%s, %s)", (gL.SetNow(), RunType))                
        run = gL.cMySql.lastrowid  # recupera id autonum generato
        if run is None:
            raise Exception("Get autonum generato con errore")        
        return run
    except Exception as err:        
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:13,代码来源:OrangeDb.py

示例8: ParseNextPage

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def ParseNextPage(source, assettype, country, pageurl, page):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        fn = gL.GetFunzione("NEXT", source, assettype, country)
        if not fn:
            raise Exception("Funzione NEXT non trovata")            
        return globals()[fn](pageurl, page)

    except Exception as err:
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:13,代码来源:OrangeParse.py

示例9: BuildQueue

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def BuildQueue(country, assettype, source, starturl, pageurl, page):     
    if gL.trace: gL.log(gL.DEBUG)   

    try:
        fn = gL.GetFunzione("QUEUE", source, assettype, country)
        if not fn:
            raise Exception("Funzione QUEUE non trovata")            
        return globals()[fn](country, assettype, source, starturl, pageurl, page)

    except Exception as err:
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:14,代码来源:OrangeParse.py

示例10: DumpGoogleResults

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def DumpGoogleResults(Asset, name, indirizzo, chk):
    if gL.trace: gL.log(gL.DEBUG)   

    if len(chk) == 0:
        return
    for item in chk:       
        gL.cMySql.execute("Delete from Debug_GoogleResults where Asset = %s", ([Asset]))             
        break
    for item in chk:
        gL.cMySql.execute("Insert into Debug_GoogleResults(Asset, AssetName, AssetAddress, GblRatio, Nome, Address, NameRatio, StreetRatio) \
                         Values (%s, %s, %s, %s, %s, %s, %s, %s)",        \
                       ( Asset, name, indirizzo, item[0], item[2], item[3], item[4], item[5]))      
    return True
开发者ID:micheledalonzo,项目名称:Orange,代码行数:15,代码来源:OrangeDb.py

示例11: LoadProxyList

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def LoadProxyList():
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        gL.cMySql.execute("Select * from RunProxies where Active = %s", ([gL.YES]) )
        proxies = gL.cMySql.fetchall()
        if len(proxies) == 0:       
            return False
        for proxy in proxies:
            gL.Proxies.append(proxy[0])
        return True
    except Exception as err:        
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:15,代码来源:OrangeDb.py

示例12: RunIdStatus

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def RunIdStatus(startend):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        if startend == "START":
            gL.cMySql.execute("Update Run set Start = %s where RunId = %s ", (gL.SetNow(), gL.RunId)) 
            
        if startend == "END":
            gL.cMySql.execute("Update Run set End = %s where RunId = %s ", (gL.SetNow(), gL.RunId)) 
            
        return True
    except Exception as err:        
        #gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:15,代码来源:OrangeDb.py

示例13: dbQueueStatus

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def dbQueueStatus(startend, country, assettype, source, starturl, pageurl, asseturl):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        if startend == "START":
            gL.cMySql.execute("Update queue set Start=%s, End=0, RunId=%s where Country=%s and AssetType=%s and Source=%s and Starturl=%s and Pageurl=%s and AssetUrl=%s", \
                                              (gL.SetNow(), gL.RunId, country, assettype, source, starturl, pageurl, asseturl))
        if startend == "END":
            gL.cMySql.execute("Update queue set End=%s, RunId=%s where Country=%s and AssetType=%s and Source=%s and Starturl=%s and Pageurl=%s and AssetUrl=%s", \
                                              (gL.SetNow(), gL.RunId, country, assettype, source, starturl, pageurl, asseturl))
    
    except Exception as err:        
        gL.log(gL.ERROR, (str(source)+ str(assettype) + country + starturl + pageurl + asseturl), err)
        return False
    return True
开发者ID:micheledalonzo,项目名称:Orange,代码行数:16,代码来源:OrangeDb.py

示例14: dbAssetOpening

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def dbAssetOpening(Asset, orario):
    if gL.trace: gL.log(gL.DEBUG)   
    try:
        gL.cMySql.execute("Delete from AssetOpening where Asset = %s ", ([Asset]))
        for j in orario:
            x = j[1][:2]+":"+j[1][2:]
            y = j[2][:2]+":"+j[2][2:]
            gL.cMySql.execute("Insert into AssetOpening(Asset, WeekDay, OpenFrom, OpenTo) Values (%s, %s, %s, %s)", \
                    (Asset, j[0], x, y))   
        return True

    except Exception as err:        
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:16,代码来源:OrangeDb.py

示例15: ParseGooglePlacesMain

# 需要导入模块: import OrangeGbl [as 别名]
# 或者: from OrangeGbl import log [as 别名]
def ParseGooglePlacesMain(Asset, AAsset):
    if gL.trace: gL.log(gL.DEBUG)   
    try:        
        gL.cMySql.execute("Select * from QAddress where Asset = %s", ([Asset]))
        row = gL.cMySql.fetchone()
        if not row:
            gL.log(gL.ERROR, "asset:" + str(Asset))
            return False           
       
        country     = row['Country']
        assettype   = row['AssetType']
        source      = row['Source']
        starturl    = row['StartUrl']
        asseturl    = row['AssetUrl']
        name        = row['name']
        address     = row['address']
        addrstreet  = row['addrstreet']
        addrcity    = row['addrcity']
        addrzip     = row['addrzip']
        addrcounty  = row['addrcounty']            
        
        gAsset = gL.ParseGooglePlaces(Asset, assettype, name, gL.xstr(addrstreet), gL.xstr(addrzip), gL.xstr(addrcity), gL.xstr(country), gL.xstr(address), AAsset )
            
        return gAsset

    except Exception as err:
        gL.log(gL.ERROR, "asset:" + str(Asset))
        gL.log(gL.ERROR, err)
        return False
开发者ID:micheledalonzo,项目名称:Orange,代码行数:31,代码来源:OrangeParse.py


注:本文中的OrangeGbl.log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。