import requests

try:
    from django.contrib.auth import authenticate, login
    from django.shortcuts import redirect, render
except ImportError:
    __lowerCAmelCase    :  Dict										= print

def   a_					(_lowerCAmelCase  :   Optional[int]       )->				List[str]:
    # Enter your recaptcha secret key here
    snake_case:						Optional[int]         =   """secretKey"""
    snake_case:						List[str]         =   """https://www.google.com/recaptcha/api/siteverify"""

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

    # from the frontend, get username, password, and client_key
    snake_case:						List[str]         =   request.POST.get("""username"""       )
    snake_case:						Optional[int]         =   request.POST.get("""password"""       )
    snake_case:						int         =   request.POST.get("""g-recaptcha-response"""       )

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



def   a_					(_lowerCAmelCase  :   int       )->				str:
    if not isinstance(_lowerCAmelCase			,	_lowerCAmelCase       ):
        snake_case:						Optional[Any]         =   (
            """operation can not be conducted on a object of type """
            F"{type(_lowerCAmelCase       ).__name__}"
        )
        raise TypeError(_lowerCAmelCase       )
    snake_case:						List[Any]         =   """"""
    for _ in range(0			,	32       ):
        bit_string += str(number % 2       )
        snake_case:						Any         =   number >> 1
    return bit_string

def   a_					(_lowerCAmelCase  :   int       )->				str:
    if number < 0:
        raise ValueError("""the value of input must be positive"""       )
    elif isinstance(_lowerCAmelCase			,	_lowerCAmelCase       ):
        raise TypeError("""Input value must be a 'int' type"""       )
    elif isinstance(_lowerCAmelCase			,	_lowerCAmelCase       ):
        raise TypeError("""'<' not supported between instances of 'str' and 'int'"""       )
    snake_case:						Optional[Any]         =   0
    # iterator over [1 to 32],since we are dealing with 32 bit integer
    for _ in range(1			,	33       ):
        # left shift the bits by unity
        snake_case:						Dict         =   result << 1
        # get the end bit
        snake_case:						Union[str, Any]         =   number % 2
        # right shift the bits by unity
        snake_case:						Union[str, Any]         =   number >> 1
        # add that bit to our ans
        snake_case:						Tuple         =   result | end_bit
    return get_reverse_bit_string(_lowerCAmelCase       )


if __name__ == "__main__":
    import doctest

    doctest.testmod()


