mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2024-10-01 01:06:03 -04:00
Set cooldown
This commit is contained in:
parent
19ce1af732
commit
7c98a15263
@ -16,6 +16,13 @@ def list_channels():
|
||||
|
||||
@api_channels.route("/channels/<channel>")
|
||||
def get_channel(channel):
|
||||
"""
|
||||
If no query specified, prints the name of the
|
||||
YouTube channel typed. When a query with the
|
||||
name "vote" is given, adds or substracts 1
|
||||
from the specified YouTube score.
|
||||
"""
|
||||
|
||||
if "vote" in request.args:
|
||||
vote = str(request.args["vote"])
|
||||
|
||||
@ -42,6 +49,7 @@ def get_channel(channel):
|
||||
|
||||
@api_channels.route("/channels/<channel>/image.svg")
|
||||
def img_channel(channel):
|
||||
""" Returns the YouTube score in a svg image. """
|
||||
if channel in channels:
|
||||
return f"""
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
|
@ -1,8 +1,16 @@
|
||||
from flask import Flask
|
||||
from api.api import api_channels
|
||||
from flask_limiter import Limiter
|
||||
from flask_limiter.util import get_remote_address
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
limiter = Limiter(
|
||||
app,
|
||||
key_func=get_remote_address,
|
||||
default_limits=["1200 per day", "50 per hour"]
|
||||
)
|
||||
|
||||
app.register_blueprint(api_channels)
|
||||
|
||||
|
||||
@ -12,4 +20,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
app.run()
|
||||
|
Loading…
Reference in New Issue
Block a user