Skip to content

Instantly share code, notes, and snippets.

View hirusha-adi's full-sized avatar
🎯
Focusing

Hirusha Adikari hirusha-adi

🎯
Focusing
View GitHub Profile
@hirusha-adi
hirusha-adi / detect.md
Last active April 28, 2023 09:28 — forked from thaiphuong5/detect.py
Flask browser detection

Check weather the user request is from a mobile phone or a computer and perform actions accordingly with flask and python3

from flask import request, render_template
import re

browser = request.user_agent.browser
version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
platform = request.user_agent.platform
uas = request.user_agent.string