Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Allwin12
Created October 1, 2020 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Allwin12/6e8648bfb63b785840f1d34898d67842 to your computer and use it in GitHub Desktop.
Save Allwin12/6e8648bfb63b785840f1d34898d67842 to your computer and use it in GitHub Desktop.
class SampleView(APIView):
def get(self, request):
user_agent = request.user_agent
browser = user_agent.browser.family
browser_version = user_agent.browser.version_string
os = user_agent.os.family
os_version = user_agent.os.version_string
is_pc = user_agent.is_pc
is_mobile = user_agent.is_mobile
return Response('success')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment