Example #1
0
 def setUp(self):
     self.opener = getHTTPOpener()
     EAPI.loadAEConfig('config.json')
     account = '*****@*****.**'
     password = '******'
     needRefreshToken = True
     r = EAPI.memberLogin(None, 0, self.opener, account, password,
                          needRefreshToken)
Example #2
0
 def setUp(self):
     self.opener = getHTTPOpener()
     EAPI.loadAEConfig(open('config.json', 'r'))
Example #3
0
        default=0,
        help='id number of category, default is root category[0].')
    parser.add_argument(
        '-w',
        '--workers',
        type=int,
        default=5,
        help=
        'numbers of worker threads when "worker" command taked, default [5].')
    args = parser.parse_args()

    logging.basicConfig(filename=_LOG_FILE, level=logging.INFO)
    logging.getLogger().addHandler(logging.StreamHandler())

    reload(sys)
    sys.setdefaultencoding("utf8")

    logging.info('[aecrawler] ===========================================')
    logging.info('[aecrawler] running at %s' %
                 datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
    logging.info('[aecrawler] ===========================================')

    EAPI.loadAEConfig(open('config.json', 'r'))

    if args.command == 'start':
        startCrawler(args.category)
    elif args.command == 'worker':
        startWorkers(args.workers)
    elif args.command == 'clear':
        clearAll()