jira = JIRA('http://jira.XXXX.com', basic_auth=(defalt_username, defalt_pwd))
    while True:
        now_time = datetime.datetime.now()
        now_time.hour
        if now_time.hour < 21 and now_time.hour > 8:
            try:
                LOGGER.info('*********测试开始**********\n')
                quer_sql = '******' #jira的选择面板,点击高级即可获取
                query_infos = jira.search_issues(quer_sql, fields="***,***", maxResults=100000)# filed 需要获取的节点名字
                softVersionIncorrectCAM = []
                deviceDrvVersionIncorrectCAM = []
                noChinaVersionCAM = []
                reportEmail = ['xxx@xxx.com']
                for query_info in query_infos:
                    issue = jira.issue(query_info.key, fields="***,***, creator")
                    VersionIssue = issue.get_field('***')
                    VersionIssue = issue.get_field('***')
                    Issue = issue.get_field('***')
                    reporterNameIssue = issue.get_field('creator').displayName
                    reporterEmailIssue = issue.get_field('creator').emailAddress
           

以上会遇到jira对象实例化不成功的现象,可以尝试清空本地COOKIE
还会遇到401的情况,需要用到APItoken,
requests.exceptions.ProxyError:
HTTPSConnectionPool(host=‘xxx.xxx.xxx’, port=443):
Max retries exceeded with url: xxxxxxx (Caused by ProxyError
(‘Cannot connect to proxy.’, NewConnectionError(’<urllib3.connection.HTTPSConnection object at 0x000001EF209B1D30>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。’)))

原因:

http连接太多没有关闭导致的
可能是访问过于频繁,使用IP代理即可

在这里插入图片描述

在这里插入图片描述

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐