Make pagination to 20

This commit is contained in:
Robert Miles 2018-10-14 17:01:48 -04:00
parent a08d21e40d
commit f582d044e9
1 changed files with 4 additions and 3 deletions

7
app.py
View File

@ -4,9 +4,9 @@ app = Flask(__name__)
def pagination(tweets,page):
if page==1:
return tweets[-10:]
return tweets[-20:]
else:
return tweets[(page*-10):((page-1)*-10)]
return tweets[(page*-20):((page-1)*-20)]
TWEETFILE = "tweets.txt"
USERFILE = "users.txt"
@ -20,4 +20,5 @@ def index():
@app.route("/api/plain/tweets")
def tweets_get():
return "\n".join(get_tweets())
page = int(request.args.get("page",1))
return "\n".join(pagination(get_tweets(),page))