cytaxii.py
def request_handler(self, method, url, json_data=None, query_params=None):
        """
        This method is used to handle all TAXII requests
        :param query_params: Any query params to pass
        :param method: Enter the HTTP method to use
        :param url: Enter the URL to make the request to
        :param json_data: Enter the json data to pass as a payload
        """
        try:
            if method == 'GET':
                response = requests.get(url=url, data=json_data, headers=self.headers, auth=self.auth,
                                        params=query_params)
            elif method == 'POST':
                response = requests.post(url=url, data=json_data, headers=self.headers, auth=self.auth,
                                         params=query_params)
            else:
                return {
                    'response': 'Unsupported Method requested',
                    'status': False,
                    'status_code': 405
                }
            headers = response.headers

            status_code = response.status_code

            if response.ok:
                response_json = response.json()
                status = True
            else:
                response_json = response.text
                status = False

        except Exception as e:
            status_code = 'EXCEPTION'
            response_json = str(e)
            status = False
            headers = None

        return {
            'response': response_json,
            'status': status,
            'status_code': status_code,
            'headers': headers
        }

        This method is used to handle all TAXII requests
        :param query_params: Any query params to pass
        :param method: Enter the HTTP method to use
        :param url: Enter the URL to make the request to
        :param json_data: Enter the json data to pass as a payload
        
This method is used to handle all TAXII requests
This method is used to handle all TAXII requests
def request_handler(self, method, url, json_data=None, query_params=None):
        try:
            if method == 'GET':
                response = requests.get(url=url, data=json_data, headers=self.headers, auth=self.auth,
                                        params=query_params)
            elif method == 'POST':
                response = requests.post(url=url, data=json_data, headers=self.headers, auth=self.auth,
                                         params=query_params)
            else:
                return {
                    'response': 'Unsupported Method requested',
                    'status': False,
                    'status_code': 405
                }
            headers = response.headers
            status_code = response.status_code
            if response.ok:
                response_json = response.json()
                status = True
            else:
                response_json = response.text
                status = False
        except Exception as e:
            status_code = 'EXCEPTION'
            response_json = str(e)
            status = False
            headers = None
        return {
            'response': response_json,
            'status': status,
            'status_code': status_code,
            'headers': headers
        }
def request_handler ( self , method , url , json_data = None , query_params = None ) : try : if method == 'GET' : response = requests . get ( url = url , data = json_data , headers = self . headers , auth = self . auth , params = query_params ) elif method == 'POST' : response = requests . post ( url = url , data = json_data , headers = self . headers , auth = self . auth , params = query_params ) else : return { 'response' : 'Unsupported Method requested' , 'status' : False , 'status_code' : 405 } headers = response . headers status_code = response . status_code if response . ok : response_json = response . json ( ) status = True else : response_json = response . text status = False except Exception as e : status_code = 'EXCEPTION' response_json = str ( e ) status = False headers = None return { 'response' : response_json , 'status' : status , 'status_code' : status_code , 'headers' : headers }
This method is used to handle all TAXII requests
This method is used to handle all TAXII requests
"""
        This method is used to handle all TAXII requests
        :param query_params: Any query params to pass
        :param method: Enter the HTTP method to use
        :param url: Enter the URL to make the request to
        :param json_data: Enter the json data to pass as a payload
        """
self
method
Enter the HTTP method to use
Enter the HTTP method to use
url
Enter the URL to make the request to
Enter the URL to make the request to
json_data
Enter the json data to pass as a payload
Enter the json data to pass as a payload
query_params
Any query params to pass
Any query params to pass