示例#1
0
 def __init__(self,location, lastID):
     '''
     Constructor
     ID grabber needs a location to search on
     '''
     self.location = location
     self.TwiAuth = twiAuth.twiAuth("TweetPony")
     self.API = self.TwiAuth.Api
     self.minID = lastID
     self.maxID = 415486363714590720
     self.lastID = self.randomStart()
     
示例#2
0
def testTwitAuth():
	import twython 
	import twiAuth
	import gevent
	#gevent.sleep(900)
	myCreds = twiAuth.twiAuth()
	randomNum = 1401925121566576641
	mypool = gevent.pool.Pool(20)
	spawned = 0
	while True: 
		spawned = spawned + 1
		mypool.spawn(limitTester, myCreds, randomNum)
		randomNum = randomNum - 1000000
		if spawned is 30:
			break
		
		#totalderp = totalderp + int(myderp.value)
	global apiCalls
	print "made this many apiCalls: ", apiCalls
示例#3
0
	def __init__(self, ip):
		self.peerlist = []
		self.logger = HarvesterLog.HarvesterLog("client")
		self.logger2 = HarvesterLog.HarvesterLog("clientDebug")
		self.numAPICalls = 0
		self.printCurrentTime()
		
		#Twitter Auth Stuff
		self.TwiAuth = twiAuth.twiAuth()
		self.TwiApi = self.TwiAuth.Api
		'''
		### Server module
		print "In client mode, attempting to connect to ", ip
		self.validateIP(ip)
		self.server_ip = ip
		self.server_port = 20002
		self.chatComm = self.connectToServer(self.server_ip)
		self.connectToOtherClients(self.chatComm)
		### // Server Module
		'''
		
		### Database Module
		print "Client attempting to connect to database"
		self.dbConn = self.connectToDB()
		self.testDBConn(self.dbConn)
		### // Database Module		
		
		
		### ID Grabbing Module 
		print colored("Starting ID grabbing module", "green")
		self.IDqueue = Queue.Queue(400)
		self.beginTweetID = 253018723156381696
		self.lastIDGrabbed = 253018723156381696
		self.IDGrabber = Greenlet.spawn(self.grabIDSpawners)
		
		self.IDputterPool = gevent.pool.Pool(1)
		Greenlet.spawn(self.spawnIDPutters)
		### // ID grabbing module
		
				
		### Input ID from Folder Module
		#FIXME: Put back the ID folder grabber module
		#self.IDFolderGrabber = Greenlet.spawn(self.FolderGrabber)
		### // Input ID Module
		
		'''
		### Chat Module
		print "Initializing chat module"
		self.clientListener = Greenlet.spawn(self.listenOnSocket)
		### // Chat Module
		'''
		
		### Tweet Grabber Module
		self.TweetIDQueue = Queue.Queue(4)
		self.IDGrabberPool = gevent.pool.Pool(1)
		Greenlet.spawn(self.spawnIDDBGrabbers)
		
		self.TweetGrabbedQueue = Queue.Queue(1000)
		self.TweetInsertPool = gevent.pool.Pool(3)
		Greenlet.spawn(self.spawnTweetInserters)
		
		self.TweetGrabPool = gevent.pool.Pool(4)
		Greenlet.spawn(self.spawnTweetGrabbers)
		
		#=======================================================================
		# self.resetUserDatabase()		
		#=======================================================================
		
		### Monitor Module
		#FIXME: put back the monitor module
		#------------------------------------ Greenlet.spawn(self.MonitorThread)
		### //Monitor Module

		while True:
			gevent.sleep(10)