Skip to content

Commit 20e3820

Browse files
committed
IDEV-2013: Update README.md
1 parent b7f7ec6 commit 20e3820

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,28 @@ The Feed API standard access pattern is to periodically request the most recent
246246
- Either an `after=-60` query parameter, where (in this example) -60 indicates the previous 60 seconds.
247247
- Or `after` and `before` query parameters for a time range, with each parameter accepting an ISO-8601 UTC formatted timestamp (a UTC date and time of the format YYYY-MM-DDThh:mm:ssZ)
248248

249-
### Handling iterative response from RTUF endpoints:
249+
## Handling iterative response from RTUF endpoints:
250250

251251
Since we may dealing with large feeds datasets, the python wrapper uses `generator` for efficient memory handling. Therefore, we need to iterate through the `generator` if we're accessing the partial results of the feeds data.
252-
Example:
252+
253+
### Single request because the requested data is within the maximum result:
254+
```python
255+
from domaintools import API
256+
257+
api = API(USERNAME, KEY, always_sign_api_key=False)
258+
results = api.nod(sessionID="my-session-id", after=-60)
259+
260+
for result in results.response() # generator that holds NOD feeds data for the past 60 seconds and is expected to request only once
261+
# do things to result
262+
```
263+
264+
## Multiple requests because the requested data is more than the maximum result per request:
253265
```python
254266
from domaintools import API
255267

256268
api = API(USERNAME, KEY, always_sign_api_key=False)
257269
results = api.nod(sessionID="my-session-id", after=-7200)
258270

259-
for result in results.response() # generator that holds 2 hours of NOD feeds data
260-
partial_data = result # In JSONL format
261-
# do things
271+
for partial_result in results.response() # generator that holds NOD feeds data for the past 2 hours and is expected to request multiple times
272+
# do things to partial_result
262273
```

0 commit comments

Comments
 (0)