mirror of
https://github.com/LucasVbr/LucasVbr.git
synced 2026-05-16 17:11:50 +00:00
Add random Quote
This commit is contained in:
@@ -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 -->
|
||||
|
||||
@@ -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,2 +1,3 @@
|
||||
flask
|
||||
json
|
||||
requests
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user