Fixed error when missing phrase or keyword (#70)
This commit is contained in:
parent
5a32685b19
commit
a3a662c6a2
1 changed files with 4 additions and 1 deletions
|
|
@ -113,7 +113,10 @@ def search_recent_tweets_by_keywords(
|
||||||
"Authorization": f"Bearer {context.authorization.token}",
|
"Authorization": f"Bearer {context.authorization.token}",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
query = " ".join([f'"{phrase}"' for phrase in phrases]) + " ".join(keywords)
|
query = " ".join([f'"{phrase}"' for phrase in (phrases or [])]) + " " + " "
|
||||||
|
if keywords:
|
||||||
|
query += " ".join(keywords or [])
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"query": query,
|
"query": query,
|
||||||
"max_results": max(max_results, 10), # X API does not allow 'max_results' less than 10
|
"max_results": max(max_results, 10), # X API does not allow 'max_results' less than 10
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue