Ejemplo n.º 1
0
    def create_filter(self, publisher_name, filter):
        """Create a Gnip filter.

        @type publisher_name string
        @param publisher_name The publisher to create filter for
        @type filter Filter
        @param filter A populated Filter object
        @return string containing response from the server

        Creates a new filter on the Gnip server, based on the
        passed in filter.

        """
        return self.create_filter_from_xml(publisher_name, filter.to_xml())
Ejemplo n.º 2
0
    def create_filter(self, publisher_scope, publisher_name, filter):
        """Create a Filter on the Gnip service.

        @type publisher_scope string
        @param publisher_scope The scope of the publisher ("my," "public" or "gnip")  
        @type publisher_name string
        @param publisher_name The publisher that the Filter will be applied to.
        @type filter Filter
        @param filter A populated Filter object
        @return string containing response from the server

        Creates a new filter, specific to your account, on the Gnip service.
        """
        url_path = "/" + publisher_scope + "/publishers/" + publisher_name + "/filters.xml"
        return self.__parse_response(self.__do_http_post(url_path, filter.to_xml()))
Ejemplo n.º 3
0
    def update_filter(self, publisher_scope, publisher_name, filter):
        """Update a Gnip filter.

        @type publisher_scope string
        @param publisher_scope The scope of the publisher (my, public or gnip)  
        @type publisher_name string
        @param publisher_name The publisher of the filter
        @type filter Filter
        @param filte A populated Filter object
        @return string containing response from the server

        Updates the Filter on the Gnip service with the Filter provided.
        The Filter must already exist on the service.

        """
        url_path = "/" + publisher_scope + "/publishers/" + publisher_name + "/filters/" + filter.name + ".xml"
        return self.__parse_response(self.__do_http_put(url_path, filter.to_xml()))
Ejemplo n.º 4
0
    def create_filter(self, publisher_scope, publisher_name, filter):
        """Create a Gnip filter.

        @type publisher_scope string
        @param publisher_scope The scope of the publisher (my, public or gnip)  
        @type publisher_name string
        @param publisher_name The publisher to create filter for
        @type filter Filter
        @param filter A populated Filter object
        @return string containing response from the server

        Creates a new filter on the Gnip server, based on the
        passed in filter.

        """
        url_path = "/" + publisher_scope + "/publishers/" + publisher_name + "/filters.xml"
        return self.__parse_response(self.__do_http_post(url_path, filter.to_xml()))