Example #1
0
    def analyses_iter(self, count_per_request=100, **kwargs):
        """
        Iterator over self.analyses.

        :param count_per_request:
        :param kwargs:
        :return:
        """
        logger.debug("Use analysis iterator")
        kwargs.pop("analysis_id", None)
        return iterator(func=self.analyses,
                        count_per_request=count_per_request,
                        item_key=None,
                        **kwargs)
Example #2
0
def main():
    # Create VxCubeApi
    api = VxCubeApi(api_key=API_KEY, version=2.0)

    sha256 = set()
    # Use samples_iter of VxCubeApi
    for sample in api.samples_iter():
        sha256.add(sample.sha256)

    # Use iterator
    for sample in iterator(api.samples, count_per_request=100, item_key=None):
        assert sample.sha256 in sha256

    # Use all_items
    all_sha256 = {
        s.sha256
        for s in all_items(api.samples, count_per_request=100, item_key=None)
    }
    assert sha256 == all_sha256
    print(sha256)
Example #3
0
def test_iterator_with_key():
    count = 0
    for i, j in enumerate(iterator(iterable_func(100, "i"), count_per_request=9, item_key="i")):
        count += 1
        assert i == j
    assert count == 100
Example #4
0
def test_iterator_without_key():
    count = 0
    for i, j in enumerate(iterator(iterable_func(100), count_per_request=10, item_key=None)):
        count += 1
        assert i == j
    assert count == 100
Example #5
0
 def phone_actions_iter(self, count_per_request=100, search=None):
     logger.debug("Use phone-action iterator")
     return iterator(func=self.phone_actions,
                     count_per_request=count_per_request,
                     search=search)
Example #6
0
 def intents_iter(self, count_per_request=100, search=None):
     logger.debug("Use intent iterator")
     return iterator(func=self.intents,
                     count_per_request=count_per_request,
                     search=search)
Example #7
0
 def apilog_iter(self, count_per_request=100, search=None):
     logger.debug("Use API-log iterator")
     return iterator(func=self.apilog,
                     count_per_request=count_per_request,
                     search=search)
Example #8
0
 def networks_iter(self, count_per_request=100, search=None):
     logger.debug("Use network iterator")
     return iterator(func=self.networks,
                     count_per_request=count_per_request,
                     search=search)
Example #9
0
 def drops_iter(self, count_per_request=100, search=None):
     logger.debug("Use drop iterator")
     return iterator(func=self.drops,
                     count_per_request=count_per_request,
                     search=search)