diff --git a/pony.py b/pony.py index 970d0c7..66eb799 100644 --- a/pony.py +++ b/pony.py @@ -1,16 +1,20 @@ import requests from flask import Flask, render_template import random +from flask_bootstrap import Bootstrap + app = Flask(__name__) +Bootstrap(app) + # Пишем свой API-key из https://derpibooru.org/registrations/edit -api_key = "ваш_код" +api_key = "nYTuAw8EHfHyfL6TgXPk" +querry = 'batpony,safe,cute' # Ищем картинки на derpi def get_random_batpony_image(): - mypage = random.randint(1,1000) - url = f"https://derpibooru.org/api/v1/json/search?q=batpony%2Csafe&page={mypage}&key={api_key}" + url = f"https://derpibooru.org/api/v1/json/search?q={querry}%2Csafe&key={api_key}" response = requests.get(url) data = response.json() @@ -31,4 +35,4 @@ def index(): tags=random_batpony_image["tags"]) if __name__ == "__main__": - app.run(debug=True) + app.run(debug=True) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index f4d16af..ade0222 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,30 +1,53 @@ - + - Рандом бетпони поисковик + Batpony Image + - + -

Рандом бетпони поисковик

- - Random Batpony Image -

Источник: {{ view_url }}

-

Теги: {{ tags }}

-
- +

Random Pony Generator by DarkShy

+
+
+
+ Batpony Image +
+
+

Tags: {{ tags }}

+ Посмотреть на Derpibooru +
+
+
+ \ No newline at end of file