mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2024-10-01 01:06:03 -04:00
Add request header
This commit is contained in:
parent
9242a8ac13
commit
42c6416569
@ -1,6 +1,6 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from flask import Blueprint, request, jsonify
|
||||
from flask import Blueprint, request, jsonify, make_response
|
||||
|
||||
with open("data.json", "r", encoding="utf8") as read_data:
|
||||
channels = json.load(read_data)
|
||||
@ -59,8 +59,7 @@ def get_channel(channel):
|
||||
def img_channel(channel):
|
||||
""" Returns the YouTube score in a svg image. """
|
||||
|
||||
if channel in channels:
|
||||
return f"""
|
||||
svg_image = f"""
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
width="52px" height="22px" viewBox="0 0 52 22" fill="none">
|
||||
<style>
|
||||
@ -77,5 +76,10 @@ def img_channel(channel):
|
||||
</g>
|
||||
</svg>
|
||||
"""
|
||||
|
||||
if channel in channels:
|
||||
response = make_response(svg_image)
|
||||
response.headers.set('Content-Type', 'image/svg+xml')
|
||||
return response
|
||||
else:
|
||||
return "Channel not found on the list"
|
||||
|
@ -31,3 +31,5 @@ contributor provided matches and I watch some videos looking for well explanatio
|
||||
video quality, coverage of the topics it explains, among others), but, of course, I'm only one person,
|
||||
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.
|
||||
|
||||
<img src="127.0.0.1:5000/channels/LearningLad/image.svg">
|
Loading…
Reference in New Issue
Block a user