TweetFeels cannot work from AWS EC2
Closed this issue · 1 comments
Simple test code works fine on local machine.
Cloned local conda environment to EC2 and activated.
Code runs, but ALWAYS returns "no tweets".
No errors.
Simplest possible code.
No apparent way to discern why it simply won't run on EC2.
Test code is:
#!/usr/bin/env python3
from tweetfeels import TweetFeels
from pathlib import Path
from time import sleep
kw = "bitcoin, BTC"
API keys for twitter (keys are installed)
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
login = [consumer_key, consumer_secret, access_token, access_token_secret]
print(f"\nStarting to run BTCfeels sampling.\n")
feels = TweetFeels(login, tracking=kw.split(","))
feels.start()
sleep(30)
#conditional and detailed reporting:
if feels.sentiment:
report = "\n" + str(feels.sentiment.start) + ";" + str(feels.sentiment.end) + ";" + str(feels.sentiment.volume) + ";" + str(feels.sentiment.value)
print(f"start;end;volume;value")
print(report)
print(flush=True)
else:
report = "\nnothing;nothing;nothing;nothing"
print(f"No sentiment value to report.")
with open('BTCfeels.txt', 'a') as fd:
fd.write(report)
feels.stop()