Skip to content

Commit 0fc1c74

Browse files
committed
IDEV-2062: Implement realtime domain risk wrapper.
1 parent 9112f67 commit 0fc1c74

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

domaintools/api.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,3 +1187,34 @@ def noh(self, **kwargs) -> FeedsResults:
11871187
cls=FeedsResults,
11881188
**kwargs,
11891189
)
1190+
1191+
def realtime_domain_risk(self, **kwargs) -> FeedsResults:
1192+
"""Returns back list of the realtime domain risk feed.
1193+
Contains realtime domain risk information for apex-level domains, regardless of observed traffic.
1194+
1195+
domain: str: Filter for an exact domain or a substring contained within a domain by prefixing or suffixing your substring with "*". Check the documentation for examples
1196+
1197+
before: str: Filter for records before the given time value inclusive or time offset relative to now
1198+
1199+
after: str: Filter for records after the given time value inclusive or time offset relative to now
1200+
1201+
headers: bool: Use in combination with Accept: text/csv headers to control if headers are sent or not
1202+
1203+
sessionID: str: A custom string to distinguish between different sessions
1204+
1205+
top: int: Limit the number of results to the top N, where N is the value of this parameter.
1206+
"""
1207+
validate_feeds_parameters(kwargs)
1208+
endpoint = kwargs.pop("endpoint", Endpoint.FEED.value)
1209+
source = ENDPOINT_TO_SOURCE_MAP.get(endpoint).value
1210+
if endpoint == Endpoint.DOWNLOAD.value or kwargs.get("output_format", OutputFormat.JSONL.value) != OutputFormat.CSV.value:
1211+
# headers param is allowed only in Feed API and CSV format
1212+
kwargs.pop("headers", None)
1213+
1214+
return self._results(
1215+
f"domain-risk-({source})",
1216+
f"v1/{endpoint}/domainrisk/",
1217+
response_path=(),
1218+
cls=FeedsResults,
1219+
**kwargs,
1220+
)

domaintools/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class OutputFormat(Enum):
3232
"newly-observed-hosts-feed-(s3)",
3333
"domain-registration-data-access-protocol-feed-(api)",
3434
"domain-registration-data-access-protocol-feed-(s3)",
35+
"domain-risk-feed-(api)",
36+
"domain-risk-feed-(s3)",
3537
"real-time-domain-discovery-feed-(api)",
3638
"real-time-domain-discovery-feed-(s3)",
3739
]

0 commit comments

Comments
 (0)