projects
/
osm
/
RO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enabling Pylint in RO and removing unused methods
[osm/RO.git]
/
RO-SDN-juniper_contrail
/
osm_rosdn_juniper_contrail
/
rest_lib.py
diff --git
a/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/rest_lib.py
b/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/rest_lib.py
index
963f6cf
..
fff489d
100644
(file)
--- a/
RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/rest_lib.py
+++ b/
RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/rest_lib.py
@@
-14,11
+14,11
@@
# License for the specific language governing permissions and limitations
# under the License.
# License for the specific language governing permissions and limitations
# under the License.
-import requests
-import json
import copy
import copy
-
+import json
from time import time
from time import time
+
+import requests
from requests.exceptions import ConnectionError
from requests.exceptions import ConnectionError
@@
-43,10
+43,10
@@
class ServiceUnavailableException(HttpException):
class ContrailHttp(object):
class ContrailHttp(object):
- def __init__(self, auth_info, logger):
+ def __init__(self, auth_info, logger
, verify
):
self._logger = logger
self._logger = logger
- #
default don't v
erify client cert
- self.
_ssl_verify = False
+ #
V
erify client cert
+ self.
ssl_verify = verify
# auth info: must contain auth_url and auth_dict
self.auth_url = auth_info["auth_url"]
self.auth_dict = auth_info["auth_dict"]
# auth info: must contain auth_url and auth_dict
self.auth_url = auth_info["auth_url"]
self.auth_dict = auth_info["auth_dict"]
@@
-162,9
+162,7
@@
class ContrailHttp(object):
except AuthError:
# If there is an auth error retry just once
if retry_auth_error:
except AuthError:
# If there is an auth error retry just once
if retry_auth_error:
- return self._request(
- self, op, url, headers, data, retry_auth_error=False
- )
+ return self._request(op, url, headers, data, retry_auth_error=False)
def _request_noauth(self, op, url, headers, data=None):
# Method to execute http requests with error control
def _request_noauth(self, op, url, headers, data=None):
# Method to execute http requests with error control
@@
-247,10
+245,14
@@
class ContrailHttp(object):
return requests.get(url, headers=headers, params=query_params)
def _http_post_headers(self, url, headers, json_data=None):
return requests.get(url, headers=headers, params=query_params)
def _http_post_headers(self, url, headers, json_data=None):
- return requests.head(url, json=json_data, headers=headers, verify=False)
+ return requests.head(
+ url, json=json_data, headers=headers, verify=self.ssl_verify
+ )
def _http_post(self, url, headers, json_data=None):
def _http_post(self, url, headers, json_data=None):
- return requests.post(url, json=json_data, headers=headers, verify=False)
+ return requests.post(
+ url, json=json_data, headers=headers, verify=self.ssl_verify
+ )
def _http_delete(self, url, headers, json_data=None):
return requests.delete(url, json=json_data, headers=headers)
def _http_delete(self, url, headers, json_data=None):
return requests.delete(url, json=json_data, headers=headers)