Skip to content

Update q param to take list of str#85

Merged
mattlisiv merged 3 commits intomattlisiv:masterfrom
jonnymaserati:master
Jul 6, 2023
Merged

Update q param to take list of str#85
mattlisiv merged 3 commits intomattlisiv:masterfrom
jonnymaserati:master

Conversation

@jonnymaserati
Copy link
Copy Markdown
Contributor

Addresses issue #82. Tested with the following and it worked:

from newsapi import NewsApiClient
import os

api_key = os.environ.get("NEWSAPI_KEY")

api = NewsApiClient(api_key=api_key)

r = api.get_everything(q=["Wave Inc", "Space Power Technologies", "Emrod"])

Check result in debug console:

>>> r.get('status')
'ok'

Comment thread newsapi/utils.py

if PY3:

def is_valid_string_or_list(var):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this a separate function because some of the data type checks only need a single str, but some can take a list of str. I plan to make some more pull requests to better align with the API that will make use of these functions.

@mattlisiv mattlisiv merged commit a183969 into mattlisiv:master Jul 6, 2023
@mattlisiv
Copy link
Copy Markdown
Owner

Thanks for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants