def handShake(url, password): handShakeRounds = 4 Blocks.initStatus(url) for i in xrange(handShakeRounds): url = Blocks.handShakeNext() if Blocks.handShakeNext() else url r = Requestor(url) r.browserLikeBehavior() while r.isNotAvailable(None): print "Not yet!" time.sleep(100) continue newBlock = r.linkStructure(url) Blocks.addBlock(newBlock) Blocks.handShakeStep(password)
#!/usr/bin/env python # -*- encoding: utf-8 -*- import os import sys this_directory = os.path.dirname(__file__) root = os.path.abspath(os.path.join(this_directory, '..')) sys.path.insert(0, root) from lib.requestor import Requestor r = Requestor('http://localhost:8000') r.browserLikeBehavior()