-
Notifications
You must be signed in to change notification settings - Fork 33
IDEV-2020 handle large response feeds improved #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
3c2d37b
0c7b051
18ffd9c
f3a15c6
23f3fbf
9bb7e8c
3953216
6a8a76a
ee1577b
711418d
0bca37b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
| from ordereddict import OrderedDict | ||
|
|
||
| from itertools import zip_longest | ||
| from types import GeneratorType | ||
|
|
||
| from domaintools_async import AsyncResults as Results | ||
|
|
||
|
|
||
|
|
@@ -141,3 +143,21 @@ def flattened(self): | |
| flat[f"contact_{contact_key}_{i}"] = " | ".join(contact_value) if type(contact_value) in (list, tuple) else contact_value | ||
|
|
||
| return flat | ||
|
|
||
|
|
||
| class FeedsResults(Results): | ||
| """Returns the generator for feeds results""" | ||
|
|
||
| def response(self) -> GeneratorType: | ||
| status_code = None | ||
briluza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| while status_code != 200: | ||
| resp_data = super().response() | ||
|
||
| status_code = self.status | ||
| yield resp_data | ||
|
|
||
| self._data = None | ||
| self._response = None | ||
| if not self.kwargs.get("sessionID"): | ||
| # we'll only do iterative request for queries that has sessionID. | ||
| # Otherwise, we will have an infinite request if sessionID was not provided but the required data asked is more than the maximum (1 hour of data) | ||
| break | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should use the
typing.Generatorto add type hinting as I think thisGeneratorTypeis use to check if the object is a generator type object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed already.