Use client-side query validation to catch syntax errors before making API calls
validate_query()
method to check query syntax before you make API
calls:
is_valid
(bool): Whether the query passes validationerror_message
(str): Detailed error description if validation fails, or
empty string if validget_all_articles()
and
get_all_headlines()
. You can control this behavior:
ValueError
with the specific error message.