Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在connect上输入密码_Python - Fatal编程技术网

Python 在connect上输入密码

Python 在connect上输入密码,python,Python,我想使用请求模块用Python连接到我的webvewier,但我在连接时设置了密码 如何使python输入密码?当我看到没有任何东西被发送到服务器时,我会认为这一切都在浏览器中。在各种论坛的帮助下,我实际上编写了一个类似的代码。 我将输入FalseUser并通过,原因很明显,正如这里的几行代码所示,我不知道这是否是google登录url import requests url = 'https://www.google.com/login' #the address of the server

我想使用请求模块用Python连接到我的webvewier,但我在连接时设置了密码


如何使python输入密码?当我看到没有任何东西被发送到服务器时,我会认为这一切都在浏览器中。

在各种论坛的帮助下,我实际上编写了一个类似的代码。 我将输入FalseUser并通过,原因很明显,正如这里的几行代码所示,我不知道这是否是google登录url

import requests
url = 'https://www.google.com/login' #the address of the server youre logging into
username = 'foo@gmail.com' #your username
password = 'bar' #your password
requests.Session().get(url)
login_data = dict(USERNAME=username, PASSWORD=password)#Important; not all sites use USERNAME and PASSWORD, use chrome console to check
requests.Session().post(url, data=login_data)
page = requests.Session().get("https://www.google.com")#you can export the page html to a string like this, I'm supposing youre doing something else

当然,任何变量都可以有任何名称,只有在字典中,用户名和密码必须更改为特定的名称。

在各种论坛的帮助下,我实际上编写了一个类似的代码。 我将输入FalseUser并通过,原因很明显,正如这里的几行代码所示,我不知道这是否是google登录url

import requests
url = 'https://www.google.com/login' #the address of the server youre logging into
username = 'foo@gmail.com' #your username
password = 'bar' #your password
requests.Session().get(url)
login_data = dict(USERNAME=username, PASSWORD=password)#Important; not all sites use USERNAME and PASSWORD, use chrome console to check
requests.Session().post(url, data=login_data)
page = requests.Session().get("https://www.google.com")#you can export the page html to a string like this, I'm supposing youre doing something else
当然,任何变量都可以有任何名称,只有在字典中,用户名和密码必须更改为特定的名称。

这会有帮助这会有帮助