Skip to content

Commit cbfc611

Browse files
Reformat VerticalFeedsStatistics
1 parent 1fc3ad4 commit cbfc611

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

ReversingLabs/SDK/ticloud.py

+19-21
Original file line numberDiff line numberDiff line change
@@ -5879,47 +5879,45 @@ def feed_query(self, category, filter, weeks=0, all_time=False):
58795879
filtered by category. The service can return a list of malware family names
58805880
newly added to each category, the number of unieque new samples added for each
58815881
malware family in a category, and a list of top 20 malware families per category
5882-
param: category: Corresponds to the verticals feed category the user is requesting to access.
5882+
:param category: Corresponds to the verticals feed category the user is requesting to access.
58835883
Only one category can be requested in each query. Note that the response for the 'exploit'
58845884
category contains addional 'scanner_coverage' data not found in other categories.
58855885
Enum: 'financial', 'retail', 'ransomware', 'apt', 'exploit', 'configuration'
5886-
type: category: str
5887-
param: filter: applied to filter data to request. Enum: 'first_seen', 'counts', 'top_list'
5888-
type: filter: str
5889-
param: weeks: specifies the number of weeks for which the data will be returned in response
5890-
type: weeks: int
5891-
param: all_time: Instructs the service to return all available data for the requested category
5892-
type all_time: boolean
5886+
:type category: str
5887+
:param filter: applied to filter data to request. Enum: 'first_seen', 'counts', 'top_list'
5888+
:type filter: str
5889+
:param weeks: specifies the number of weeks for which the data will be returned in response
5890+
:type weeks: int
5891+
:param all_time: Instructs the service to return all available data for the requested category
5892+
:type all_time: boolean
58935893
"""
58945894
if category not in VERTICAL_FEEDS_CATEGORIES:
58955895
raise WrongInputError("Only the following categories are allowed: {category}".format(
58965896
category=VERTICAL_FEEDS_CATEGORIES))
58975897

5898-
if filter.lower() not in ("counts", "top_list", "first_seen"):
5898+
if filter not in ("counts", "top_list", "first_seen"):
58995899
raise WrongInputError("Only the following filters are allowed: 'counts', 'top_list' and 'first_seen'")
59005900

5901+
query_params = {
5902+
"format": "json"
5903+
}
5904+
59015905
if isinstance(weeks, int):
59025906

59035907
if weeks not in range(0, 30):
59045908
raise WrongInputError("The value for weeks can be a number between 0 and 30")
59055909

5906-
query_params = {
5907-
"weeks": weeks,
5908-
"format": "json"
5909-
}
5910-
5911-
raise WrongInputError("Weeks needs to be provided as integer")
5910+
query_params["weeks"] = weeks
59125911

59135912
if all_time:
5913+
query_params["all_time"] = "true"
59145914

5915-
query_params = {
5916-
"all_time": "true",
5917-
"format": "json"
5918-
}
5915+
if "weeks" in query_params:
5916+
raise WrongInputError("The all_time parameter can not be used together with weeks.")
59195917

59205918
endpoint = self.__API_FEED_ENDPOINT.format(
5921-
category = category,
5922-
filter = filter
5919+
category=category,
5920+
filter=filter
59235921
)
59245922

59255923
url = self._url.format(endpoint=endpoint)

0 commit comments

Comments
 (0)