From: beierlm Date: Wed, 19 Aug 2020 20:45:38 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/v8.0' X-Git-Tag: release-v9.0-start~21 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F9600%2F1;p=osm%2Fosmclient.git Merge remote-tracking branch 'origin/v8.0' Change-Id: I7015eb11371e7cade6e42c3b82e5a5021661ab84 Signed-off-by: beierlm --- 7b6400a05cddf680f4ba80df157ecedfd3fc3b88 diff --cc osmclient/sol005/http.py index b737894,0228d6a..9a7bc6e --- a/osmclient/sol005/http.py +++ b/osmclient/sol005/http.py @@@ -14,13 -14,13 +14,14 @@@ # License for the specific language governing permissions and limitations # under the License. ++import copy from io import BytesIO --import pycurl import json import logging --import copy ++ from osmclient.common import http from osmclient.common.exceptions import OsmHttpException, NotFound ++import pycurl class Http(http.Http): @@@ -33,16 -33,16 +34,16 @@@ self._http_header = None self._logger = logging.getLogger('osmclient') self._default_query_admin = None -- self._all_projects = None; -- self._public = None; ++ self._all_projects = None ++ self._public = None if 'all_projects' in kwargs: -- self._all_projects=kwargs['all_projects'] ++ self._all_projects = kwargs['all_projects'] if 'public' in kwargs: -- self._public=kwargs['public'] ++ self._public = kwargs['public'] self._default_query_admin = self._complete_default_query_admin() def _complete_default_query_admin(self): -- query_string_list=[] ++ query_string_list = [] if self._all_projects: query_string_list.append("ADMIN") if self._public is not None: @@@ -78,7 -78,7 +79,7 @@@ curl_cmd = self._get_curl_cmd(endpoint, skip_query_admin) curl_cmd.setopt(pycurl.CUSTOMREQUEST, "DELETE") curl_cmd.setopt(pycurl.WRITEFUNCTION, data.write) -- self._logger.info("Request METHOD: {} URL: {}".format("DELETE",self._url + endpoint)) ++ self._logger.info("Request METHOD: {} URL: {}".format("DELETE", self._url + endpoint)) curl_cmd.perform() http_code = curl_cmd.getinfo(pycurl.HTTP_CODE) self._logger.info("Response HTTPCODE: {}".format(http_code)) @@@ -110,7 -110,7 +111,7 @@@ jsondata = json.dumps(postfields_dict) if 'password' in postfields_dict: postfields_dict_copy = copy.deepcopy(postfields_dict) -- postfields_dict_copy['password']='******' ++ postfields_dict_copy['password'] = '******' jsondata_log = json.dumps(postfields_dict_copy) else: jsondata_log = jsondata @@@ -124,16 -124,16 +125,16 @@@ formfile[1])))]) elif filename is not None: with open(filename, 'rb') as stream: -- postdata=stream.read() ++ postdata = stream.read() self._logger.verbose("Request POSTFIELDS: Binary content") curl_cmd.setopt(pycurl.POSTFIELDS, postdata) if put_method: -- self._logger.info("Request METHOD: {} URL: {}".format("PUT",self._url + endpoint)) ++ self._logger.info("Request METHOD: {} URL: {}".format("PUT", self._url + endpoint)) elif patch_method: -- self._logger.info("Request METHOD: {} URL: {}".format("PATCH",self._url + endpoint)) ++ self._logger.info("Request METHOD: {} URL: {}".format("PATCH", self._url + endpoint)) else: -- self._logger.info("Request METHOD: {} URL: {}".format("POST",self._url + endpoint)) ++ self._logger.info("Request METHOD: {} URL: {}".format("POST", self._url + endpoint)) curl_cmd.perform() http_code = curl_cmd.getinfo(pycurl.HTTP_CODE) self._logger.info("Response HTTPCODE: {}".format(http_code)) @@@ -167,8 -167,8 +168,8 @@@ skip_query_admin=skip_query_admin) def patch_cmd(self, endpoint='', postfields_dict=None, -- formfile=None, filename=None, -- skip_query_admin=False): ++ formfile=None, filename=None, ++ skip_query_admin=False): self._logger.debug("") return self.send_cmd(endpoint=endpoint, postfields_dict=postfields_dict, @@@ -182,7 -182,7 +183,7 @@@ curl_cmd = self._get_curl_cmd(endpoint, skip_query_admin) curl_cmd.setopt(pycurl.HTTPGET, 1) curl_cmd.setopt(pycurl.WRITEFUNCTION, data.write) -- self._logger.info("Request METHOD: {} URL: {}".format("GET",self._url + endpoint)) ++ self._logger.info("Request METHOD: {} URL: {}".format("GET", self._url + endpoint)) curl_cmd.perform() http_code = curl_cmd.getinfo(pycurl.HTTP_CODE) self._logger.info("Response HTTPCODE: {}".format(http_code)) @@@ -209,7 -209,7 +210,7 @@@ def set_query_admin(self, **kwargs): if 'all_projects' in kwargs: -- self._all_projects=kwargs['all_projects'] ++ self._all_projects = kwargs['all_projects'] if 'public' in kwargs: -- self._public=kwargs['public'] ++ self._public = kwargs['public'] self._default_query_admin = self._complete_default_query_admin()