Fixed error when missing phrase or keyword (#70)

This commit is contained in:
Sterling Dreyer 2024-09-25 16:18:36 -07:00 committed by GitHub
parent 5a32685b19
commit a3a662c6a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,7 +113,10 @@ def search_recent_tweets_by_keywords(
"Authorization": f"Bearer {context.authorization.token}",
"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 = {
"query": query,
"max_results": max(max_results, 10), # X API does not allow 'max_results' less than 10