与auth的python帖子

时间:2015-01-02 22:10:21

标签: python-2.7 post oauth

好的,这是我的代码,我想要做的是发布到受密码保护的页面,你可以查看下面的代码,看看我出错的地方

!在/ usr / bin中/ Python的

导入请求,sys,socket,json from requests.auth import HTTPDigestAuth,HTTPBasicAuth

172.168.101.214

params = {' @ Generate':' New'} response = requests.post(' https://TerraceQ.internal.ca/views/Debug_Dump/1',auth = HTTPDigestAuth(' user',' fakepassword'),data = params) print response.status_code

1 个答案:

答案 0 :(得分:0)

这有效吗

ip="172.168.99.99"
try:
    response = requests.get('https://' + ip + '/views', auth=HTTPDigestAuth('username', 'password'), verify=False)
except urllib3.exceptions.SSLError as e:
    sys.exit('test')