Add random Quote

This commit is contained in:
LucasVbr
2022-05-19 23:54:02 +02:00
parent d8b76c2199
commit e5429f3ddd
4 changed files with 18 additions and 1 deletions
+6
View File
@@ -3,6 +3,12 @@
# Hi <img src="https://raw.githubusercontent.com/iampavangandhi/iampavangandhi/master/gifs/Hi.gif" alt="👋" width="50px"/>, I'm LucasVbr
### A passionate developer from France
---
"*Talent is God-given; be humble. Fame is man-given; be thankful. Conceit is self-given; be careful.*"
by Harvey Mackay
</div>
<!-- Badges -->
+5 -1
View File
@@ -4,6 +4,7 @@ __author__ = "LucasVbr"
__version__ = "3.0.0"
from flask import render_template
import requests
import flask
import json
@@ -18,9 +19,12 @@ if __name__ == "__main__":
with open(DATA_FILE) as file:
data = json.load(file)
# Get random quote
quote = requests.get("https://api.quotable.io/random")
# Build from template and data
with app.app_context():
rendered = render_template(TEMPLATE_FILE, data=data)
rendered = render_template(TEMPLATE_FILE, data=data, quote=quote.json())
# Generate Markdown file
with open(OUTPUT_FILE, "w", encoding="utf8") as file:
+1
View File
@@ -1,2 +1,3 @@
flask
json
requests
+6
View File
@@ -3,4 +3,10 @@
# Hi {{ img(data.hi.src, data.hi.alt, data.hi.width) }}, I'm LucasVbr
### A passionate developer from France
---
"*{{ quote.content }}*"
by {{ quote.author }}
</div>