爬蟲認證ES用戶,並訪問api

        password_mgr = request.HTTPPasswordMgrWithDefaultRealm()
        password_mgr.add_password(None, top_level_url, username, password)
        handler = request.HTTPBasicAuthHandler(password_mgr)
        opener = request.build_opener(handler)
        a_url = top_level_url + "/_cluster/stats"
        resultData = opener.open(a_url)
        resultData = json.loads(resultData.read().decode())    
相關文章
相關標籤/搜索