i have a little script wich is taking the number of tweets using tweetstream and write that to a file, but i see there is a limit of 50/s, maybe because the file IO, i want to try to store the value in a variable and then, every 10 minutes write the file with the value of the variable, how can i do that?
#!/usr/bin/python
import tweetstream
import sys
print sys.argv
twitterUsername = "username"
twitterPassword = "password"
twitterWordFilter = sys.argv[1]
try:
with tweetstream.FilterStream(twitterUsername, twitterPassword,track=twitterWordFilter) as stream:
for tweet in stream:
file = open('/monitor/'+str(sys.argv[2])+'.txt','w+')
file.write(str(stream.count))
file.close
#print tweet #Use for raw output
except tweetstream.ConnectionError, e:
print "Disconnected from twitter. Reason:", e.reason