import json
import re
import random
import urllib
import base64
import StringIO
import gzip
from model.log4py import Log4py
import sys
from model import syscontext
import os
import wx
import rsa
from rsa import transform

logger = Log4py().getLogger("run")


class LoginSinaCom():
    def __init__(self, **kwargs):
        #INIT cookie load object
        self.cj = cookielib.LWPCookieJar()
        self.cookie_support = urllib2.HTTPCookieProcessor(self.cj)
        self.opener = urllib2.build_opener(self.cookie_support,
                                           urllib2.HTTPHandler)
        urllib2.install_opener(self.opener)
        self.soft_path = kwargs.get("soft_path", "")
        self.cookiefile = os.path.join(self.soft_path, "cookie.dat")
        self.proxyip = kwargs.get("proxyip", "")
        self.pcid = ""
        self.servertime = ""
import re
import time
import json
import random
import workerpool
from Queue import Queue, Empty

import wx

from model.msgentity import *  #@UnusedWildImport
from sina.weiborequest import getMillitime
from sina.sinaWburl2ID import midToStr, sinaWburl2ID

from model.log4py import Log4py

logger = Log4py().getLogger('run')


#用户消息采集类
#解析用首页,调用采集工作累,创建采集线程
#限于.COM
class UsermsgCrawler(workerpool.Job):
    def __init__(self, **kwargs):
        #print kwargs
        self.result_queue = kwargs.get("result_queue", "")
        self.thread_id = kwargs.get("thread_id", "")
        self.window = kwargs.get("window", "")
        self.thread_num = kwargs.get("thread_num", "")
        self.output_path = kwargs.get("output_path", "")
        self.user = kwargs.get("user", {})
        self.max_page = kwargs.get("max_page", 1)
#
# WeiboMsgBackup is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeiboMsgBackup; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

import ConfigParser
import os
from model.log4py import Log4py
import re

logger = Log4py().getLogger('CrawlerThread')


class UserConfig():
    def __init__(self, rootPath=""):
        self.config = ConfigParser.ConfigParser()
        self.rootPath = rootPath
        self.configPath = "file\\config.ini"

    def WriteUserConfig(self, _type, value):
        try:
            value = value.replace(r'\n', '')
            if self.rootPath != "":
                configFile = os.path.join(self.rootPath, self.configPath)
                if not os.path.exists(configFile):
                    f = file(configFile, "w")
Created on 2012-3-14

@author: Zoe
'''
import wx
import threading
import sys

from model.log4py import Log4py

from model import syscontext
from model.userconfig import UserConfig
import os
from sina.loginsinacom import LoginSinaCom

logger = Log4py().getLogger('LoginThread')

class LoginThread(threading.Thread):
    def __init__(self, threadNum, window, username, password):
        threading.Thread.__init__(self)
        self.threadNum = threadNum
        self.window = window
        self.timeToQuit = threading.Event()
        self.timeToQuit.clear()
        self.username = username
        self.password = password
        self.userConfig = UserConfig(syscontext.userentity["path"])
        #for lock
        self.lock = threading.Lock()
        self.lockcondition=threading.Condition(self.lock)
        
Beispiel #5
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeiboMsgBackup; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

import wx
from wx import html
import json
from model.userentity import *
import sys
from model.log4py import Log4py
from model import syscontext

log = Log4py()
logger = log.getLogger('run')


class SearchResFrame(wx.Frame):
    def __init__(self, parent, title, userData=None):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 500))
        self.parent = parent
        #self.CreateStatusBar()
        html = MyHtmlWin(self, parent)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()
        html.SetRelatedFrame(self, self.GetTitle() + " -- %s")  #关联HTML到框架
        #html.SetRelatedStatusBar(0) #关联HTML到状态栏
        htmlStr = self.ParseData2Html(userData)
        wx.CallAfter(html.SetPage, htmlStr)
Beispiel #6
0
'''
Created on 2012-3-14

@author: Zoe
'''
import wx
import threading
import sys

from model.log4py import Log4py

from model import syscontext
from model.userconfig import UserConfig
from model.mainaction import MainAction

logger = Log4py().getLogger('StartCrawlThread')


class StartCrawlThread(threading.Thread):
    """
    This just simulates some long-running task that periodically sends
    a message to the GUI thread.
    """
    def __init__(self, threadNum, window, event):
        threading.Thread.__init__(self)
        self.threadNum = threadNum
        self.window = window
        self.timeToQuit = threading.Event()
        self.timeToQuit.clear()
        self.userConfig = UserConfig(syscontext.userentity["path"])
        self.event = event