diff --git a/voter/Procfile b/voter/Procfile index 6f18d33..dc46f1b 100644 --- a/voter/Procfile +++ b/voter/Procfile @@ -1 +1 @@ -web: gunicorn api:app \ No newline at end of file +web: gunicorn main:app \ No newline at end of file diff --git a/voter/data.json b/voter/data.json index eb0a8bf..3f409e8 100644 --- a/voter/data.json +++ b/voter/data.json @@ -1,10 +1,10 @@ { - "Tech_With_Tim": 0, + "Tech_With_Tim": 11, "Derek_Banas": 0, "Don_Jones": 0, "Corey_Schafer": 0, "Brian_Will": 0, - "LearningLad": 0, + "LearningLad": -7, "David_Bombal": 0, "Ben_Eater": 0, "The_Coding_Train": 0, diff --git a/voter/api.py b/voter/main.py similarity index 90% rename from voter/api.py rename to voter/main.py index ba6f0e5..255d11a 100644 --- a/voter/api.py +++ b/voter/main.py @@ -1,5 +1,4 @@ import json -from datetime import datetime from flask import Flask, jsonify, make_response, request from flask_limiter import Limiter from flask_limiter.util import get_remote_address @@ -53,11 +52,6 @@ def get_channel(channel): with open("data.json", "w", encoding="utf8") as write_data: json.dump(channels, write_data, indent=4) - # Write to log file. - with open("log.txt", "a") as append: - today = datetime.today().strftime('%Y-%m-%d-%H:%M') - append.write(f"\n{vote.title()}d {channel} on {today}") - return f"You {vote}d successfully the channel {channel}." else: return "Channel not found on the list." @@ -72,7 +66,8 @@ def get_channel(channel): def img_channel(channel): """ Returns the YouTube score in a svg image. """ - svg_image = f""" + if channel in channels: + svg_image = f""" """ - if channel in channels: response = make_response(svg_image) response.headers.set('Content-Type', 'image/svg+xml') return response @@ -99,4 +93,4 @@ def img_channel(channel): if __name__ == "__main__": - app.run() + app.run(debug=True) diff --git a/voter/readme.md b/voter/readme.md index 0ed97a5..4cf23fe 100644 --- a/voter/readme.md +++ b/voter/readme.md @@ -32,4 +32,4 @@ video quality, coverage of the topics it explains, among others), but, of course so I think being able to receive opinions from all users is a good way to filter and have truly awesome content based on the community's opinion. - \ No newline at end of file + \ No newline at end of file