Add API_SEARCH_KEY to environment variables and update main functionality to use it for searches
This commit is contained in:
@@ -4,3 +4,4 @@ USERNAME=""
|
||||
PASSWORD=""
|
||||
EMAIL=""
|
||||
EMAIL_PASSWORD=""
|
||||
API_SEARCH_KEY=""
|
||||
3
main.py
3
main.py
@@ -46,6 +46,7 @@ async def main():
|
||||
password = os.getenv("PASSWORD")
|
||||
email = os.getenv("EMAIL")
|
||||
email_password = os.getenv("EMAIL_PASSWORD")
|
||||
api_search_key = os.getenv("API_SEARCH_KEY")
|
||||
|
||||
await api.pool.add_account(username, password, email, email_password, cookies=cookies)
|
||||
await api.pool.login_all() # try to login to receive account cookies
|
||||
@@ -55,7 +56,7 @@ async def main():
|
||||
if check_if_json_exists(OUTPUT_FILE):
|
||||
_results = load_json(OUTPUT_FILE).get("tweets", [])
|
||||
|
||||
async for rep in api.search("AI"):
|
||||
async for rep in api.search(api_search_key):
|
||||
try:
|
||||
_results.append(rep.json())
|
||||
logger.info("Appended tweet JSON")
|
||||
|
||||
Reference in New Issue
Block a user