[英]How to login to the website by receiving email/password from the user in requests in python?
I can login to website in requests with string in python. but i want to login by getting data from user我可以在请求中使用 python 中的字符串登录网站。但我想通过从用户那里获取数据来登录
import requests
geturl = xxxqweasd.com
postData = {
'email': 'xxxxsad@gmail.com',
'password': 'sadsafdsafPass'
}
login = asd.post(getUrl, headers=headers, data=postData)
but i want this.但我想要这个。
email= input("login your email:")
password = input("login your password:")
login = asd.post(getUrl, headers=headers, data=postData)
and done.并做了。
how can i do this?我怎样才能做到这一点?
edit:编辑:
It logs in first, then the 2FA screen comes up.它首先登录,然后出现 2FA 屏幕。 then I want to enter that 2fa code.
然后我想输入那个 2fa 代码。
first login with strings首先使用字符串登录
then 2fa screen然后2fa屏幕
and then i take 2fa code on email然后我在 email 上输入 2fa 代码
and I enter the 2fa code.然后我输入 2fa 代码。
You might want to read up on how variables and specifically dicts work on w3schools.您可能想阅读有关变量和特别是命令如何在w3schools上工作的信息。
email= input("login your email:")
password = input("login your password:")
post_data = {
'email': email,
'password': password
}
login = asd.post(getUrl, headers=headers, data=post_data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.