| def parse_results(res: dict) -> str: | def parse_results(res: dict) -> str: | ||||
| """Process response from Serply Job Search.""" | """Process response from Serply Job Search.""" | ||||
| jobs = res.get("jobs", []) | jobs = res.get("jobs", []) | ||||
| if not jobs: | |||||
| if not res or "jobs" not in res: | |||||
| raise ValueError(f"Got error from Serply: {res}") | raise ValueError(f"Got error from Serply: {res}") | ||||
| string = [] | string = [] |
| def parse_results(res: dict) -> str: | def parse_results(res: dict) -> str: | ||||
| """Process response from Serply News Search.""" | """Process response from Serply News Search.""" | ||||
| news = res.get("entries", []) | news = res.get("entries", []) | ||||
| if not news: | |||||
| if not res or "entries" not in res: | |||||
| raise ValueError(f"Got error from Serply: {res}") | raise ValueError(f"Got error from Serply: {res}") | ||||
| string = [] | string = [] |
| def parse_results(res: dict) -> str: | def parse_results(res: dict) -> str: | ||||
| """Process response from Serply News Search.""" | """Process response from Serply News Search.""" | ||||
| articles = res.get("articles", []) | articles = res.get("articles", []) | ||||
| if not articles: | |||||
| if not res or "articles" not in res: | |||||
| raise ValueError(f"Got error from Serply: {res}") | raise ValueError(f"Got error from Serply: {res}") | ||||
| string = [] | string = [] |
| def parse_results(res: dict) -> str: | def parse_results(res: dict) -> str: | ||||
| """Process response from Serply Web Search.""" | """Process response from Serply Web Search.""" | ||||
| results = res.get("results", []) | results = res.get("results", []) | ||||
| if not results: | |||||
| if not res or "results" not in res: | |||||
| raise ValueError(f"Got error from Serply: {res}") | raise ValueError(f"Got error from Serply: {res}") | ||||
| string = [] | string = [] |