Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 2925-2951 (lines=27) @@
2922
        cmd.set_attribute('tag_id', tag_id)
2923
        return self._send_xml_command(cmd)
2924
2925
    def get_targets(self, filter=None, filter_id=None, trash=None,
2926
                    tasks=None):
2927
        """Request a list of targets
2928
2929
        Arguments:
2930
            filter (str, optional): Filter term to use for the query
2931
            filter_id (str, optional): UUID of an existing filter to use for
2932
                the query
2933
            trash (boolean, optional): Whether to get the trashcan targets
2934
                instead
2935
            tasks (boolean, optional): Whether to include list of tasks that
2936
                use the target
2937
2938
        Returns:
2939
            The response. See :py:meth:`send_command` for details.
2940
        """
2941
        cmd = XmlCommand('get_targets')
2942
2943
        _add_filter(cmd, filter, filter_id)
2944
2945
        if not trash is None:
2946
            cmd.set_attribute('trash', _to_bool(trash))
2947
2948
        if not tasks is None:
2949
            cmd.set_attribute('tasks', _to_bool(tasks))
2950
2951
        return self._send_xml_command(cmd)
2952
2953
    def get_target(self, target_id):
2954
        """Request a single target
@@ 2772-2798 (lines=27) @@
2769
        cmd.set_attribute('scanner_id', scanner_id)
2770
        return self._send_xml_command(cmd)
2771
2772
    def get_schedules(self, filter=None, filter_id=None, trash=None,
2773
                      tasks=None):
2774
        """Request a list of schedules
2775
2776
        Arguments:
2777
            filter (str, optional): Filter term to use for the query
2778
            filter_id (str, optional): UUID of an existing filter to use for
2779
                the query
2780
            trash (boolean, optional): Whether to get the trashcan schedules
2781
                instead
2782
            tasks (boolean, optional): Whether to include tasks using the
2783
                schedules
2784
2785
        Returns:
2786
            The response. See :py:meth:`send_command` for details.
2787
        """
2788
        cmd = XmlCommand('get_schedules')
2789
2790
        _add_filter(cmd, filter, filter_id)
2791
2792
        if not trash is None:
2793
            cmd.set_attribute('trash', _to_bool(trash))
2794
2795
        if not tasks is None:
2796
            cmd.set_attribute('tasks', _to_bool(tasks))
2797
2798
        return self._send_xml_command(cmd)
2799
2800
    def get_schedule(self, schedule_id):
2801
        """Request a single schedule
@@ 1913-1937 (lines=25) @@
1910
        cmd.set_attributes(kwargs)
1911
        return self._send_xml_command(cmd)
1912
1913
    def get_alerts(self, filter=None, filter_id=None, trash=None, tasks=None):
1914
        """Request a list of alerts
1915
1916
        Arguments:
1917
            filter (str, optional): Filter term to use for the query
1918
            filter_id (str, optional): UUID of an existing filter to use for
1919
                the query
1920
            trash (boolean, optional): True to request the alerts in the
1921
                trashcan
1922
            tasks (boolean, optional): Whether to include the tasks using the
1923
                alerts
1924
        Returns:
1925
            The response. See :py:meth:`send_command` for details.
1926
        """
1927
        cmd = XmlCommand('get_alerts')
1928
1929
        _add_filter(cmd, filter, filter_id)
1930
1931
        if not trash is None:
1932
            cmd.set_attribute('trash', _to_bool(trash))
1933
1934
        if not tasks is None:
1935
            cmd.set_attribute('tasks', _to_bool(tasks))
1936
1937
        return self._send_xml_command(cmd)
1938
1939
    def get_alert(self, alert_id):
1940
        """Request a single alert