Load tweets from text file

This commit is contained in:
Robert Miles 2018-10-14 00:32:59 -04:00
parent 6b05119b61
commit 8d7dba548e
2 changed files with 7 additions and 2 deletions

8
app.py
View File

@ -2,7 +2,11 @@ from flask import *
app = Flask(__name__)
tweets = ["test\thttps://example.org/blah.txt\t2018-10-13T23:55:36-04:00\tfuck"]
TWEETFILE = "tweets.txt"
USERFILE = "users.txt"
def get_tweets():
with open(TWEETFILE) as f:
return "\n".split(f.read())
@app.route("/")
def index():
@ -10,4 +14,4 @@ def index():
@app.route("/api/plain/tweets")
def tweets_get():
return "\n".join(tweets)
return "\n".join(get_tweets())

1
tweets.txt Normal file
View File

@ -0,0 +1 @@
test https://example.org/blah.txt 2018-10-13T23:55:36-04:00 fuck