misp.py
def handler(self, method, endpoint, params=None, data=None,
                **kwargs):
        """
        Method to handle all requests across the class
        """
        try:
            url = "{0}/{1}".format(self.base_url, endpoint)

            if method == "GET":
                response = requests.get(url=url, json=data, params=params, verify=self.verify, headers=self.headers)

            elif method == "POST":
                response = requests.post(url=url, data=data, params=params, verify=self.verify, headers=self.headers)

            else:
                return {
                    "result": "Invalid Method",
                    "status": False,
                    "status_code": None
                }

            status_code = response.status_code

            if response.ok:
                if len(response.text) == 0:
                    response_text = "No response returned"
                else:
                    response_text = response.json()
                status = True

            else:
                response_text = response.text
                status = False

            return {
                "result": response_text,
                "status": status,
                "status_code": status_code
            }

        except Exception as e:
            return {
                "result": str(e),
                "status": False,
                "status_code": None
            }

        Method to handle all requests across the class
        
Method to handle all requests across the class
Method to handle all requests across the class
def handler(self, method, endpoint, params=None, data=None,
                **kwargs):
        try:
            url = "{0}/{1}".format(self.base_url, endpoint)
            if method == "GET":
                response = requests.get(url=url, json=data, params=params, verify=self.verify, headers=self.headers)
            elif method == "POST":
                response = requests.post(url=url, data=data, params=params, verify=self.verify, headers=self.headers)
            else:
                return {
                    "result": "Invalid Method",
                    "status": False,
                    "status_code": None
                }
            status_code = response.status_code
            if response.ok:
                if len(response.text) == 0:
                    response_text = "No response returned"
                else:
                    response_text = response.json()
                status = True
            else:
                response_text = response.text
                status = False
            return {
                "result": response_text,
                "status": status,
                "status_code": status_code
            }
        except Exception as e:
            return {
                "result": str(e),
                "status": False,
                "status_code": None
            }
def handler ( self , method , endpoint , params = None , data = None , ** kwargs ) : try : url = "{0}/{1}" . format ( self . base_url , endpoint ) if method == "GET" : response = requests . get ( url = url , json = data , params = params , verify = self . verify , headers = self . headers ) elif method == "POST" : response = requests . post ( url = url , data = data , params = params , verify = self . verify , headers = self . headers ) else : return { "result" : "Invalid Method" , "status" : False , "status_code" : None } status_code = response . status_code if response . ok : if len ( response . text ) == 0 : response_text = "No response returned" else : response_text = response . json ( ) status = True else : response_text = response . text status = False return { "result" : response_text , "status" : status , "status_code" : status_code } except Exception as e : return { "result" : str ( e ) , "status" : False , "status_code" : None }
Method to handle all requests across the class
Method to handle all requests across the class
"""
        Method to handle all requests across the class
        """
self
method
endpoint
params
data