def payVerify(self): # 捷易通查单网址: # http://dx.jieyitong.net/system/index.asp if self.btPayVerify.text() == u'开始验证': seller_payment = 10.00 jytPaymentString = unicode(self.textEdit.toPlainText()) payList = jytPaymentString.split('\n') tdLength = 7 if len(payList) < tdLength: return payList = payList[1 : len(payList) - 1] userPayMap = {} rows = len(payList) / tdLength for row in range(rows): itemList = payList[tdLength * row : tdLength * (row + 1)] if not re.match(r'\d', itemList[0]): continue if itemList[1] != u'资金转入': continue if float(itemList[2]) < seller_payment: continue taobaoId = itemList[6].split(' ')[0] # 2011-3-9 3:57:00 ymdhms = re.match(r'(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)', itemList[4]).groups() seller_paytime = datetime(int(ymdhms[0]), int(ymdhms[1]), int(ymdhms[2]), int(ymdhms[3]), int(ymdhms[4]), int(ymdhms[5])) userPayMap[taobaoId] = seller_paytime self.autoAction = VerifyAction(u'ghosert', u'011849', u'011849', userPayMap) view = WebView(self.tabWidget, self.autoAction) view.load(QUrl("http://i.taobao.com/")) self.btPayVerify.setText(u'停止验证') self.btBeginPai.setDisabled(True) else: self.autoAction.termintateAll(self.tabWidget) self.btPayVerify.setText(u'开始验证') self.btBeginPai.setDisabled(False)
def beginPai(self): # jiawzhang TODO: If running tons of view.load, I saw "Segmentation fault" and then PyQt exits, not sure Windows has the same issue, google it 'Segmentation fault Qt webkit'! if self.btBeginPai.text() == u'开始拍货': # Make sure fill in unicode characters. self.autoAction = PaiAction(u'捷易通充值平台加款卡10元自动转帐', u'ghosert', u'011849', u'011849', 9.90, 10.00, u'捷易通ID: ghosert') self.connect(self.autoAction, SIGNAL('terminateAll'), self.btBeginPai.click) view = WebView(self.tabWidget, self.autoAction) view.load(QUrl("http://www.taobao.com/")) # view.load(QUrl("http://item.taobao.com/item.htm?id=9248227645")) self.btBeginPai.setText(u'停止拍货') self.btPayVerify.setDisabled(True) else: self.autoAction.termintateAll(self.tabWidget) self.btBeginPai.setText(u'开始拍货') self.btPayVerify.setDisabled(False)
class Browser(object): def __init__(self, settings): super(Browser, self).__init__() self._settings = settings self._cookie_jar = CookieJar() self._network_access_manager = NetworkAccessManager(self._cookie_jar) self._web_page = WebPage(settings) self._web_page.setNetworkAccessManager(self._network_access_manager) self._web_view = WebView(settings) self._web_view.setPage(self._web_page) def load_url(self, url, show_ui=True): self._web_view.load(QUrl(url)) if show_ui is True: self._web_view.show() def load_html(self, html, url, cookies="", show_ui=True): if len(cookies) > 0: self._web_page.cookie_jar.load_qt_cookie(cookies) self._web_view.setHtml(html, QUrl(url)) if show_ui is True: self._web_view.show()