PythonAnywhere Forums

Twitter account stops updating status at irregular intervals

I set up a simple twitter bot on a loop but it will stop updating its status at irregular intervals. I checked to see if I got an error message from Twitter's API and when I clicked on the console I saw there was no error message and then the bot started back up again. I thought maybe it was that I had used my cpu seconds but that doesn't seem to be the case either; my dashboard read that I had used 0.00% of my CPU seconds with 10 minutes to the reset (i have a free account) but I know that could not be the case since it definitely updated the status (used CPU seconds) within the last 24 hours. Is there some other limit that PA has that I am not aware of?

the code is as follows:

import tweepy, time, fileinput, sys

argfile = "text.txt"

consumer_key = consumer_secret = access_token = access_token_secret =

auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth)

filename=open(argfile,'r') f=filename.readlines() filename.close()

for line in f: api.update_status(line) for line_number, line in enumerate(fileinput.input(argfile, inplace=1)): if line_number == 0: continue else: sys.stdout.write(line) time.sleep(900)#Tweet every 15 minutes

If you are running the code from a console, we do restart those servers periodically for system maintenance. Check out the long running tasks help page to see how to make your script run continuously using scheduled tasks.