Skip to content

Commit

Permalink
feat: add favicon route
Browse files Browse the repository at this point in the history
  • Loading branch information
nhymxu committed May 7, 2024
1 parent 96f91dc commit 13df12e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion web.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import base64
import io
import os

from asgiref.wsgi import WsgiToAsgi
from dotenv import load_dotenv
from flask import Flask
from flask import Flask, send_file

from logics.auth_middleware import require_authentication
from logics.error_handler import ErrorHandler
Expand All @@ -16,6 +18,17 @@
asgi_app = WsgiToAsgi(app)


@app.get('/favicon.ico')
def get_favicon():
# 1x1 transparent gif
b64_img = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
b = base64.b64decode(b64_img.encode('utf-8'))
buf = io.BytesIO(b)
buf.seek(0)

return send_file(buf, mimetype="image/gif")


@app.get('/')
async def hello_handler():
return 'Hello world'
Expand Down

0 comments on commit 13df12e

Please sign in to comment.