Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
umr-tetis
MOOD
mood-tetis-tweets-collect
Commits
472e319d
Commit
472e319d
authored
Jun 09, 2020
by
Rémy Decoupes
Browse files
add datetime in name of output file to protect against erasement
parent
21cd3864
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
472e319d
#### Twitter Credentials ####
params/credentials.py
#### tweets ####
output/tweetoutput.
jsonl
output/tweetoutput.
*
#### Log ####
log/collectweets.log
#### libreoffice back up ####
...
...
collectTweets.py
View file @
472e319d
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment