# Monte
from database import DAO
import sys
from optparse import OptionParser

parser = OptionParser()
parser.add_option("-t", type="string", dest="term")
parser.add_option("-u", type="string", dest="user")
parser.add_option("-n", type="string", dest="hits")

(options, args) = parser.parse_args()

if not options.term or not options.user or not options.hits:
    parser.print_help()
    sys.exit(1)

dao = DAO()

dao.insertHits(options.user, options.term, options.hits)
Example #2
0
# if auth rate is less than 10 , else use public, else quit
def runUserWithTerm(user, term):

    print "tweet"
    global dateToHits
    if auth.rate_limit_status()['remaining_hits'] > 10:
        getTweetsAuth(user, term)
    elif tweepy.api.rate_limit_status()['remaining_hits'] > 50:
        getTweets(user, term)
    else:
        for key in dateToHits:
            dao.insertHits(user, term, dateToHits[key], key)
        dao.closeDatabase()
        sys.exit(1)


# Starts the Tweet searching process
runUserWithTerm(user, term)

#Get's first 100 people that the user is following & search their tweets
friends = auth.get_user(user).friends()[:100]
for friend in friends:
    if not friend.protected:
        runUserWithTerm(friend.screen_name, term)

#Inserts Items in Database
for key in dateToHits:
    dao.insertHits(user, term, dateToHits[key], key)
dao.closeDatabase()
    else:
        for key in dateToHits:
            dao.insertHits(user, term, dateToHits[key], key)
        dao.closeDatabase()
        sys.exit(1)

# Starts the Tweet searching process
runUserWithTerm(user,term)

#Get's first 100 people that the user is following & search their tweets
friends = auth.get_user(user).friends()[:100]
for friend in friends:
    if not friend.protected:
        runUserWithTerm(friend.screen_name, term)

#Inserts Items in Database
for key in dateToHits:
    dao.insertHits(user, term, dateToHits[key], key)
dao.closeDatabase()






        
    


		
# Monte
from database import DAO
import sys
from optparse import OptionParser

parser = OptionParser()
parser.add_option("-t", type="string", dest="term")
parser.add_option("-u", type="string", dest="user")
parser.add_option("-n", type="string", dest="hits")

(options, args) = parser.parse_args()

if not options.term or not options.user or not options.hits:
	parser.print_help()
	sys.exit(1)

dao = DAO()

dao.insertHits(options.user, options.term, options.hits)