输出文件显示POST请求正常但网站仍需要授权:
import requests
import sys
def main():
session = requests.session(config={'verbose': sys.stderr})
login_data = {
'email': 'PHONE_OR_LOGIN',
'pass': 'PASSWORD',
}
r = session.post('http://vk.com/login', data=login_data)
text_file = open("save.html", "w")
text_file.write(r.content)
text_file.close()
print r.content
if __name__ == '__main__':
main()