我是python的新手,
basic_auth=('username', 'password')
有人可以给我一个基本的例子来说明如何https登录jira。
尝试以下但这对我不起作用:
jira_options = {'server':“https://jira-stability.qualcomm.com/jira/browse”} jira = JIRA(options = jira_options,basic_auth =('username',“pwd”))
WARNING:root:bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],) while doing GET https://jira-stability.qualcomm.com/jira/browse/rest/api/2/serverInfo [{u'headers': {'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'User-Agent': 'python-requests/2.9.1', 'Connection': 'keep-alive', u'X-Atlassian-Token': u'no-check', u'Cache-Control': u'no-cache', u'Content-Type': u'application/json'}, 'params': None}]
WARNING:root:Got recoverable error from GET https://jira-stability.qualcomm.com/jira/browse/rest/api/2/serverInfo, will retry [1/3] in 10s. Err: bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)
由于 沙市
答案 0 :(得分:1)
试试这个:
import urllib, urllib2, cookielib
username = 'myuser'
password = 'mypassword'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'username' : username, 'j_password' : password})
opener.open('http://www.somewebpage.com/login.php', login_data)
resp = opener.open('http://www.somewebpage.com/home.php')
print resp.read()
这是用于登录任何页面并使用python
获取响应的示例代码