/
githubmirror
/
edx-platform
Обзор
Документация
Войти
/
githubmirror
/
edx-platform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-ulmo
openedx/core/lib/mobile_utils.py
26 строк
656 B
Emad Rad
chore: typos fixed
25 май 2024, 17:35
25 май 2024, 17:35
c27d55a
Код
Авторство
О чём код?
""" Common utilities related to the mobile apps. """ import re from django.conf import settings def is_request_from_mobile_app(request): """ Returns whether the given request was made by an Open edX mobile app, either natively or through the mobile web view. Args: request (HttpRequest) """ if getattr(settings, 'MOBILE_APP_USER_AGENT_REGEXES', None): user_agent = request.META.get('HTTP_USER_AGENT') if user_agent: for user_agent_regex in settings.MOBILE_APP_USER_AGENT_REGEXES: if re.search(user_agent_regex, user_agent): return True return False