


import requests

try:
 from django.contrib.auth import authenticate, login
 from django.shortcuts import redirect, render
except ImportError:
 _SCREAMING_SNAKE_CASE    :				str       =					print
def     UpperCAmelCase__		(UpperCamelCase_       ):



     """simple docstring"""






     snake_case					=       '''secretKey'''
     snake_case					=       '''https://www.google.com/recaptcha/api/siteverify'''

     # when method is not POST, direct user to login page
     if request.method != "POST":
          return render(UpperCamelCase_							,'''login.html'''       )

     # from the frontend, get username, password, and client_key
     snake_case					=       request.POST.get('''username'''       )
     snake_case					=       request.POST.get('''password'''       )
     snake_case					=       request.POST.get('''g-recaptcha-response'''       )

     # post recaptcha response to Google's recaptcha api
     snake_case					=       requests.post(UpperCamelCase_							,data={'''secret''': secret_key, '''response''': client_key}       )
     # if the recaptcha api verified our keys
     if response.json().get('''success'''							,UpperCamelCase_       ):
          # authenticate the user
          snake_case					=       authenticate(UpperCamelCase_							,username=UpperCamelCase_							,password=UpperCamelCase_       )
          if user_in_database:
               login(UpperCamelCase_							,UpperCamelCase_       )
               return redirect('''/your-webpage'''       )
     return render(UpperCamelCase_							,'''login.html'''       )








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_SCREAMING_SNAKE_CASE    :				Optional[int]       =					{
    "configuration_layoutlm": ["LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "LayoutLMConfig", "LayoutLMOnnxConfig"],
    "tokenization_layoutlm": ["LayoutLMTokenizer"],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _SCREAMING_SNAKE_CASE    :				str       =					["LayoutLMTokenizerFast"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _SCREAMING_SNAKE_CASE    :				List[str]       =					[
     "LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST",
     "LayoutLMForMaskedLM",
     "LayoutLMForSequenceClassification",
     "LayoutLMForTokenClassification",
     "LayoutLMForQuestionAnswering",
     "LayoutLMModel",
     "LayoutLMPreTrainedModel",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _SCREAMING_SNAKE_CASE    :				Optional[int]       =					[
     "TF_LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST",
     "TFLayoutLMForMaskedLM",
     "TFLayoutLMForSequenceClassification",
     "TFLayoutLMForTokenClassification",
     "TFLayoutLMForQuestionAnswering",
     "TFLayoutLMMainLayer",
     "TFLayoutLMModel",
     "TFLayoutLMPreTrainedModel",
 ]


if TYPE_CHECKING:
 from .configuration_layoutlm import LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMConfig, LayoutLMOnnxConfig
 from .tokenization_layoutlm import LayoutLMTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_layoutlm_fast import LayoutLMTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_layoutlm import (
      LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
      LayoutLMForMaskedLM,
      LayoutLMForQuestionAnswering,
      LayoutLMForSequenceClassification,
      LayoutLMForTokenClassification,
      LayoutLMModel,
      LayoutLMPreTrainedModel,
  )
 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_layoutlm import (
      TF_LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFLayoutLMForMaskedLM,
      TFLayoutLMForQuestionAnswering,
      TFLayoutLMForSequenceClassification,
      TFLayoutLMForTokenClassification,
      TFLayoutLMMainLayer,
      TFLayoutLMModel,
      TFLayoutLMPreTrainedModel,
  )

else:
 import sys

 _SCREAMING_SNAKE_CASE    :				Optional[int]       =					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




