Commit 472e319d authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

add datetime in name of output file to protect against erasement

parent 21cd3864
#### Twitter Credentials ####
params/credentials.py
#### tweets ####
output/tweetoutput.jsonl
output/tweetoutput.*
#### Log ####
log/collectweets.log
#### libreoffice back up ####
......
......@@ -16,6 +16,7 @@ import sys
import logging
from logging.handlers import RotatingFileHandler
import pandas as pd
import time
def exitscript(logger, message):
......@@ -100,7 +101,8 @@ if __name__ == '__main__':
accounttofollowedlist = list(map(str, accounttofollowedlist))
# Start a Twitter stream
tweetouputfilename = "output/tweetoutput.jsonl"
timestr = time.strftime("%Y%m%d-%H%M%S")
tweetouputfilename = "output/tweetoutput"+timestr+".jsonl"
tweetoutput = open(tweetouputfilename, 'w')
myStreamListener = Listener(tweetoutput, logger)
stream = tweepy.Stream(auth=api.auth, listener=myStreamListener)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment