发送邮件请求python [英] send post request python

查看:135
本文介绍了发送邮件请求python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,我想查看它是否自上次检查后更新(使用哈希)。问题是我需要输入用户名和密码才能访问该网站。

I've got a website that I want to check to see if it was updated since the last check (using hash). The problem is that I need to enter a username and password before I can visit the site.

有没有办法用python输入用户名和密码?

Is there a way to input the username and the password using python?

推荐答案

查看 requests 库,你可以通过输入 pip 来输入 pip install requests ,或者通过 cmd 提示或终端,具体取决于您的操作系统。

Check out the requests library, which you can get via pip by typing pip install requests, either through the cmd prompt, or terminal, depending on your OS.

import requests

payload = {'user' : 'username',
          'pass' : 'PaSSwoRd'}

r = requests.get(r'http://www.URL.com/home', data=payload)

print r.text

你应该没问题。如果您告诉我们相关网站,我们可能会提供更好的答案。

You should be alright. If you told us the site in question we could probably provide a better answer.

这篇关于发送邮件请求python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆