Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pymisp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,6 +2135,11 @@ def fetch_feed(self, feed: MISPFeed | int | str | UUID) -> dict[str, Any] | list
response = self._prepare_request('GET', f'feeds/fetchFromFeed/{feed_id}')
return self._check_json_response(response)

def fetch_all_feeds(self) -> dict[str, Any] | list[dict[str, Any]]:
""" Fetch all the feeds: https://www.misp-project.org/openapi/#tag/Feeds/operation/fetchFromAllFeeds"""
response = self._prepare_request('GET', f'feeds/fetchFromAllFeeds')
return self._check_json_response(response)

def cache_all_feeds(self) -> dict[str, Any] | list[dict[str, Any]]:
""" Cache all the feeds: https://www.misp-project.org/openapi/#tag/Feeds/operation/cacheFeeds"""
response = self._prepare_request('GET', 'feeds/cacheFeeds/all')
Expand Down
4 changes: 3 additions & 1 deletion tests/testlive_comprehensive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,9 @@ def test_feeds(self) -> None:
# Cache all enabled feeds
r = self.admin_misp_connector.cache_all_feeds()
self.assertEqual(r['message'], 'Feed caching job initiated.')
# Fetch all enabled feeds
# Cannot test that, it fetches all the events.
# r = self.admin_misp_connector.fetch_all_feeds()
# Compare all enabled feeds
r = self.admin_misp_connector.compare_feeds()
# FIXME: https://github.com/MISP/MISP/issues/4834#issuecomment-511890466
Expand Down Expand Up @@ -3508,7 +3511,6 @@ def missing_methods(self) -> None:
"favouriteTags/getToggleField", # TODO
"feeds/feedCoverage",
"feeds/importFeeds",
"feeds/fetchFromAllFeeds",
"feeds/getEvent",
"feeds/previewIndex", # TODO
"feeds/previewEvent", # TODO
Expand Down