我该如何从我的登录表单/ Py3.7中以身份认证方式登录用户?

时间:2018-12-16 12:58:00

标签: python-3.x authentication login python-requests

您好,我正在尝试通过html代码进行登录身份验证:

<form action="primologin.py" method="post">
                        <div class="form_container">

                            <div class="label"><label for="username">Username:</label></div>
                            <div class="field"><input type="text" name="username" id="username" class="text_input initial_focus" /></div>

                            <div class="label"><label for="password">Password:</label></div>
                            <div class="field"><input type="password" name="password" id="password" class="text_input" /></div>


                        </div>

                        <div class="label"><label for="password"></label></div>
                        <div class="field"><input type="submit" value="Login" class="loginbutton"/></div>
                        <input type="hidden" name="do" value="login" />
                    </form>

用户应输入用户名和密码,并在登录时将其与phpmyadmin中的用户名和密码(已加密)进行比较 但是首先,我只是尝试对我的有效负载进行身份验证,然后将用户定向到另一个页面...

from database import *
from config import *
from encryptor import*
from html import _html5
import urllib3
import requests
from requests.auth import HTTPBasicAuth


payload = {'USERNAME': 'root', 'PASSWORD': "'ea0cYmF9L4mzNuUezXK835AzLi33CKWqOjDnnIICBlQ='"}
q = requests.post('http://localhost/index.html', params=payload)
print(q.url)
r = requests.get('http://localhost/home.php')

我不了解流程和请求的逻辑,请帮忙(我是新手)

0 个答案:

没有答案