Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:type body: str.
:param verbose: flag to determine additional output.
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:param headers: additional headers to be added to the request.
:type headers: str.
:param response: flag to return the response.
:type response: str.
:returns: returns RestResponse object containing response data
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).set(put_path, \
body=body, headers=headers)
else:
results = self.current_client.set(put_path, body=body, \
headers=headers)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
if response:
return results
:type body: str.
:param verbose: flag to determine additional output.
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:param headers: additional headers to be added to the request.
:type headers: str.
:param response: flag to return the response.
:type response: str.
:returns: returns a RestResponse object from client's Put command
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).toolput(\
put_path, body=body, headers=headers)
else:
results = self.current_client.toolput(put_path, body=body, \
headers=headers)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
if response:
return results
silent=False):
"""Main worker function for raw head command
:param put_path: the URL path.
:type put_path: str.
:param verbose: flag to determine additional output.
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:returns: returns a RestResponse object from client's Head command
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).head(put_path)
else:
results = self.current_client.head(put_path)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
if results.status == 200:
return results
else:
return None
:type body: str.
:param verbose: flag to determine additional output.
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:param headers: additional headers to be added to the request.
:type headers: str.
:param response: flag to return the response.
:type response: str.
:returns: returns a RestResponse from client's Post command
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).toolpost(\
put_path, body=body, headers=headers)
else:
results = self.current_client.toolpost(put_path, body=body, \
headers=headers)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
if response:
return results
:type put_path: str.
:param verbose: flag to determine additional output.
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:param headers: additional headers to be added to the request.
:type headers: str.
:param silent: flag to disable output.
:type silent: boolean.
:returns: returns a RestResponse object from client's Delete command
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).tooldelete(\
put_path, headers=headers)
else:
results = self.current_client.tooldelete(put_path, headers=headers)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
return results
:type verbose: boolean.
:param url: originating URL.
:type url: str.
:param sessionid: session id to be used instead of credentials.
:type sessionid: str.
:param uncache: flag to not store the data downloaded into cache.
:type uncache: boolean.
:param headers: additional headers to be added to the request.
:type headers: str.
:param response: flag to return the response.
:type response: str.
:returns: returns a RestResponse object from client's get command
"""
if sessionid:
results = RmcClient(url=url, sessionkey=sessionid).get(put_path, \
headers=headers)
else:
results = self.current_client.get(put_path, uncache=uncache, \
headers=headers)
if not silent:
self.invalid_return_handler(results, verbose=verbose)
elif results.status == 401:
raise SessionExpired()
if results.status == 200 or response:
return results
else:
return None
:param includelogs: flag to determine id logs should be downloaded.
:type includelogs: boolean.
"""
if not self.check_current_rmc_client(url=base_url):
raise CurrentlyLoggedInError("Currently logged into another " \
"server. \nPlease log out out first " \
"before logging in to another.")
existing_client = self.get_rmc_client(url=base_url)
if existing_client:
self.update_rmc_client(url=base_url, username=username,
password=password)
else:
try:
self.add_rmc_client(RmcClient(username=username, \
password=password, url=base_url))
except Exception as excp:
raise excp
try:
self.current_client.login()
except Exception as excp:
raise excp
if not skipbuild:
self.build_monolith(verbose=verbose, path=path, \
includelogs=includelogs)
self.save()