

"""simple docstring"""





import requests

try:
							from django.contrib.auth import authenticate, login
							from django.shortcuts import redirect, render
except ImportError:
							__UpperCamelCase						:   Optional[int]							   =	print

def 						__SCREAMING_SNAKE_CASE						(   A_				):
	# Enter your recaptcha secret key here
	lowerCAmelCase__			:		Union[str, Any]						       =			'''secretKey'''
	lowerCAmelCase__			:		Union[str, Any]						       =			'''https://www.google.com/recaptcha/api/siteverify'''

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

	# from the frontend, get username, password, and client_key
	lowerCAmelCase__			:		List[Any]						       =			request.POST.get('''username'''				)
	lowerCAmelCase__			:		Dict						       =			request.POST.get('''password'''				)
	lowerCAmelCase__			:		Tuple						       =			request.POST.get('''g-recaptcha-response'''				)

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







"""simple docstring"""





from typing import TYPE_CHECKING

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


__UpperCamelCase						:   Union[str, Any]							   =	{
    '''configuration_layoutlm''': ['''LAYOUTLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LayoutLMConfig''', '''LayoutLMOnnxConfig'''],
    '''tokenization_layoutlm''': ['''LayoutLMTokenizer'''],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase						:   Union[str, Any]							   =	['''LayoutLMTokenizerFast''']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase						:   Dict							   =	[
							    '''LAYOUTLM_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''LayoutLMForMaskedLM''',
							    '''LayoutLMForSequenceClassification''',
							    '''LayoutLMForTokenClassification''',
							    '''LayoutLMForQuestionAnswering''',
							    '''LayoutLMModel''',
							    '''LayoutLMPreTrainedModel''',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase						:   str							   =	[
							    '''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

							__UpperCamelCase						:   int							   =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




