nextAnalytics / reddit /load_env.py
honey234's picture
updated backend
e56eed8
import os
import asyncpraw
from dotenv import load_dotenv
load_dotenv()
# load the ENVIRONMENT
environment = os.getenv('ENVIRONMENT')
# Gemini Api keys
api_key = os.getenv('GEMINI_1')
api_key2 = os.getenv('GEMINI_2')
api_key3 = os.getenv('GEMINI_3')
api_key4 = os.getenv('GEMINI_4')
api_key5 = os.getenv('GEMINI_5')
api_key6 = os.getenv('GEMINI_6')
api_key7 = os.getenv('GEMINI_7')
api_key8 = os.getenv('GEMINI_8')
api_key9 = os.getenv('GEMINI_9')
api_key10 = os.getenv('GEMINI_10')
api_key11 = os.getenv('GEMINI_11')
# gemini spare api keys
spare_api_key1 = os.getenv('GEMINI_SPARE_KEY_1')
spare_api_key2 = os.getenv('GEMINI_SPARE_KEY_2')
spare_api_key3 = os.getenv('GEMINI_SPARE_KEY_3')
spare_api_key4 = os.getenv('GEMINI_SPARE_KEY_4')
spare_api_key5 = os.getenv('GEMINI_SPARE_KEY_5')
# Reddit credentials
reddit_client_id = os.getenv('REDDIT_CLIENT_ID')
reddit_client_secret = os.getenv('REDDIT_CLIENT_SECRET')
reddit_user_agent = os.getenv('REDDIT_USER_AGENT')
reddit_password = os.getenv('REDDIT_PASSWORD')
reddit_username = os.getenv('REDDIT_USERNAME')
reddit_client_id_2 = os.getenv('REDDIT_CLIENT_ID_2')
reddit_client_secret_2 = os.getenv('REDDIT_CLIENT_SECRET_2')
reddit_user_agent_2 = os.getenv('REDDIT_USER_AGENT_2')
reddit_password_2 = os.getenv('REDDIT_PASSWORD_2')
reddit_username_2 = os.getenv('REDDIT_USERNAME_2')
reddit_client_id_3 = os.getenv('REDDIT_CLIENT_ID_3')
reddit_client_secret_3 = os.getenv('REDDIT_CLIENT_SECRET_3')
reddit_user_agent_3 = os.getenv('REDDIT_USER_AGENT_3')
reddit_password_3 = os.getenv('REDDIT_PASSWORD_3')
reddit_username_3 = os.getenv('REDDIT_USERNAME_3')
reddit_clients = [
asyncpraw.Reddit(
client_id=reddit_client_id,
client_secret=reddit_client_secret,
password=reddit_password,
username=reddit_username,
user_agent=reddit_user_agent,
),
asyncpraw.Reddit(
client_id=reddit_client_id_2,
client_secret=reddit_client_secret_2,
password=reddit_password_2,
username=reddit_username_2,
user_agent=reddit_user_agent_2,
),
asyncpraw.Reddit(
client_id=reddit_client_id_3,
client_secret=reddit_client_secret_3,
password=reddit_password_3,
username=reddit_username_3,
user_agent=reddit_user_agent_3,
)
]
# ScraperANT
scraper_ant_api_key = os.getenv('SCRAPERANT_APIKEY')
scraper_ant_api_key2 = os.getenv('SCRAPERANT_APIKEY2')
scraper_ant_api_key3 = os.getenv('SCRAPERANT_APIKEY3')
scraper_ant_api_key4= os.getenv('SCRAPERANT_APIKEY4')
scraper_ant_keys=[
scraper_ant_api_key,
scraper_ant_api_key2,
scraper_ant_api_key3,
scraper_ant_api_key4
]
# load the BUGSNAG_TOKEN
bugsnag_token = os.getenv('BUGSNAG_TOKEN')
scraping_url = 'https://nextanalyticsscraping.onrender.com' if environment == 'DEVELOPMENT' else os.getenv('SCRAPING_URL')