summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-08-17 12:11:21 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-17 12:11:21 +0000
commitf49f5f2a94ece7d0e1ae924bc7ab77a38eeeef87 (patch)
treef8661ad3e7fe4dc38187c43679863f3311724c96
parentf01fb5609298c7c4b0f19cfe8d54fc331dd5a0ad (diff)
parent219391918bd42af63bc170712ba6268e7f009b76 (diff)
Merge "Use separate timeouts for connection and reading."
-rw-r--r--functest/energy/energy.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/functest/energy/energy.py b/functest/energy/energy.py
index 580bc6b09..c410e84f0 100644
--- a/functest/energy/energy.py
+++ b/functest/energy/energy.py
@@ -16,6 +16,7 @@ import urllib
from functools import wraps
import requests
+import urllib3
import functest.utils.functest_utils as ft_utils
@@ -76,7 +77,7 @@ class EnergyRecorder(object):
INITIAL_STEP = "running"
# Default connection timeout
- CONNECTION_TIMOUT = 1
+ CONNECTION_TIMOUT = urllib3.Timeout(connect=1, read=3)
@staticmethod
def load_config():
@@ -104,13 +105,13 @@ class EnergyRecorder(object):
"API recorder at: " + energy_recorder_uri + uri_comp)
# Creds
- user = ft_utils.get_functest_config(
+ creds_usr = ft_utils.get_functest_config(
"energy_recorder.api_user")
- password = ft_utils.get_functest_config(
+ creds_pass = ft_utils.get_functest_config(
"energy_recorder.api_password")
- if user != "" and password != "":
- energy_recorder_api_auth = (user, password)
+ if creds_usr != "" and creds_pass != "":
+ energy_recorder_api_auth = (creds_usr, creds_pass)
else:
energy_recorder_api_auth = None