82d417b9e6
Fresh start for the StarlingX automation framework. Change-Id: Ie265e0791024f45f71faad6315c2b91b022934d1
35 lines
736 B
Python
35 lines
736 B
Python
import json
|
|
from requests import Response
|
|
|
|
|
|
class RestResponse:
|
|
"""
|
|
Class for Rest Response
|
|
"""
|
|
|
|
def __init__(self, response: Response):
|
|
self.response = response
|
|
|
|
def get_status_code(self) -> int:
|
|
"""
|
|
Gets the status code from the response
|
|
|
|
Returns: status code
|
|
"""
|
|
return self.response.status_code
|
|
|
|
def get_json_content(self):
|
|
"""
|
|
Gets the json content from the response
|
|
|
|
Returns: the json content
|
|
"""
|
|
return json.loads(self.response.text)
|
|
|
|
def get_headers(self):
|
|
"""
|
|
Gets the headers from the response
|
|
|
|
Returns: the headers
|
|
"""
|
|
return self.response.headers |