<filename>main.py
"""
Main file to find and send user Craigslist housing posts.
"""

import time
import users
import posts
import mail


def main():
    """Main app to execute subscription based email notifications."""
    users_json = users.get_users()
    # At start of subscription, drop all content and populate db without sending email
    posts.drop_contents()
    for _ in posts.get(users_json):
        pass

    while True:
        # Sleep for a day (-80 seconds) to fetch posts
        print("sleeping...")
        time.sleep(86320)
        # Get users' json file for every iteration - allows for updates during operation
        users_json = users.get_users()
        user_posts = zip(users_json, posts.get(users_json))
        for user, post in user_posts:
            mail.write_email(user, post)


if __name__ == "__main__":
    main()

<filename>main.py
"""
Main file to find and send user Craigslist housing posts.
"""

import time
import users
import posts
import mail


def main():
    """Main app to execute subscription based email notifications."""
    users_json = users.get_users()
    # At start of subscription, drop all content and populate db without sending email
    posts.drop_contents()
    for _ in posts.get(users_json):
        pass

    while True:
        # Sleep for a day (-80 seconds) to fetch posts
        print("sleeping...")
        time.sleep(86320)
        # Get users' json file for every iteration - allows for updates during operation
        users_json = users.get_users()
        user_posts = zip(users_json, posts.get(users_json))
        for user, post in user_posts:
            mail.write_email(user, post)


if __name__ == "__main__":
    main()

Main file to find and send user Craigslist housing posts. Main app to execute subscription based email notifications. # At start of subscription, drop all content and populate db without sending email # Sleep for a day (-80 seconds) to fetch posts # Get users' json file for every iteration - allows for updates during operation