|
def | __init__ (self) |
|
def | process (self, proxies, queryCallback) |
|
def | insertProxy (self, proxy, queryCallback) |
|
def | isSiteExist (self, siteId, queryCallback, userId=None) |
|
def | generateCriterionSQL (self, criterions, additionWhere=None, siteId=None) |
|
def | fetchByCriterions (self, criterions, queryCallback) |
|
def | dbLock (self, mutexName, queryCallback, sleepTime=1, mutexLockTTL=Constants.DEFAULT_LOCK_TTL) |
|
def | dbUnlock (self, mutexName, queryCallback) |
|
def | createUrlsInsertQuery (self, siteId, localKeys, localValues) |
|
def | copyUrlsToDcUrls (self, siteId, queryCallback) |
|
def | statisticLogUpdate (self, localObj, urlMd5, siteId, status, queryCallback, isInsert=False) |
|
def | calculateMd5FormUrl (self, url, urlType, useNormilize=False) |
|
Definition at line 20 of file ProxyNewTask.py.
◆ __init__()
def dc_db.ProxyNewTask.ProxyNewTask.__init__ |
( |
|
self | ) |
|
◆ insertProxy()
def dc_db.ProxyNewTask.ProxyNewTask.insertProxy |
( |
|
self, |
|
|
|
proxy, |
|
|
|
queryCallback |
|
) |
| |
Definition at line 69 of file ProxyNewTask.py.
69 def insertProxy(self, proxy, queryCallback):
71 fields, values = Constants.getFieldsValuesTuple(proxy, Constants.ProxyTableDict)
72 fieldValueString = Constants.createFieldsValuesString(fields, values)
73 if fieldValueString
is not None and fieldValueString !=
"":
74 query = Constants.INSERT_COMMON_TEMPLATE % (
"sites_proxy", fieldValueString)
75 queryCallback(query, Constants.PRIMARY_DB_ID)
◆ lookProxyInDB()
def dc_db.ProxyNewTask.ProxyNewTask.lookProxyInDB |
( |
|
proxy, |
|
|
|
queryCallback |
|
) |
| |
|
static |
Definition at line 35 of file ProxyNewTask.py.
35 def lookProxyInDB(proxy, queryCallback):
37 FETCH_PROXY_SQL =
"SELECT * FROM `sites_proxy` WHERE `Site_Id` = '%s' AND `Host` = '%s'" 38 query = FETCH_PROXY_SQL % (proxy.siteId, proxy.host)
39 res = queryCallback(query, Constants.PRIMARY_DB_ID)
40 if hasattr(res,
'__iter__')
and len(res) > 0
and res[0]
is not None:
◆ process()
def dc_db.ProxyNewTask.ProxyNewTask.process |
( |
|
self, |
|
|
|
proxies, |
|
|
|
queryCallback |
|
) |
| |
Definition at line 50 of file ProxyNewTask.py.
50 def process(self, proxies, queryCallback):
51 ret = GeneralResponse()
53 if not ProxyNewTask.lookProxyInDB(proxy, queryCallback):
54 if self.insertProxy(proxy, queryCallback):
60 ret.statuses.append(status)
The documentation for this class was generated from the following file: