|
9 | 9 | from rich.progress import Progress, SpinnerColumn, TextColumn |
10 | 10 |
|
11 | 11 | from domaintools.api import API |
12 | | -from domaintools.constants import Endpoint, OutputFormat |
| 12 | +from domaintools.constants import Endpoint, FEEDS_PRODUCTS_LIST, OutputFormat |
13 | 13 | from domaintools.cli.utils import get_file_extension |
14 | 14 | from domaintools.exceptions import ServiceException |
15 | 15 | from domaintools._version import current as version |
@@ -110,6 +110,8 @@ def args_to_dict(*args) -> Dict: |
110 | 110 | def _get_formatted_output(cls, cmd_name: str, response, out_format: str = "json"): |
111 | 111 | if cmd_name in ("available_api_calls",): |
112 | 112 | return "\n".join(response) |
| 113 | + if response.product in FEEDS_PRODUCTS_LIST: |
| 114 | + return "\n".join([data for data in response.response()]) |
113 | 115 | return str(getattr(response, out_format) if out_format != "list" else response.as_list()) |
114 | 116 |
|
115 | 117 | @classmethod |
@@ -227,7 +229,10 @@ def run(cls, name: str, params: Optional[Dict] = {}, **kwargs): |
227 | 229 |
|
228 | 230 | if isinstance(out_file, _io.TextIOWrapper): |
229 | 231 | # use rich `print` command to prettify the ouput in sys.stdout |
230 | | - print(response) |
| 232 | + if response.product in FEEDS_PRODUCTS_LIST: |
| 233 | + print(output) |
| 234 | + else: |
| 235 | + print(response) |
231 | 236 | else: |
232 | 237 | # if it's a file then write |
233 | 238 | out_file.write(output if output.endswith("\n") else output + "\n") |
|
0 commit comments