smtp_username = "" smtp_password = "" ''' # If using SSL on port 587, and you get this error: # ssl.SSLError: [Errno 1] _ssl.c:504: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol # use port 465 rather than 587. # - http://stackoverflow.com/questions/12854572/connect-to-smtp-ssl-or-tls-using-python smtp_host = "<smtp_host>" smtp_port = 465 smtp_use_ssl = True smtp_username = "******" smtp_password = "******" reddit_collector.email_initialize( smtp_host_IN = smtp_host, smtp_port_IN = smtp_port, smtp_use_ssl_IN = smtp_use_ssl, smtp_username_IN = smtp_username, smtp_password_IN = smtp_password ) # set email address to which status updates will be sent. reddit_collector.set_email_status_address( "<email_address>" ) # test sending email status (from and to the email_status_address). #reddit_collector.email_send_status( "test message", "test subject" ) # first, retrieve one or more posts from database using Django QuerySets # - https://docs.djangoproject.com/en/dev/ref/models/querysets/ import reddit_collect.models # get all posts where the related subreddit has filter_1 = True. #matching_subreddit_qs = reddit_collect.models.Subreddit.objects.filter( filter_1 = True ).values( 'id' ) # get all posts where the related subreddit has filter_2 = True AND filter_1 = False. matching_subreddit_qs = reddit_collect.models.Subreddit.objects.filter( filter_2 = True ) matching_subreddit_qs = matching_subreddit_qs.filter( filter_1 = False ) matching_subreddit_qs = matching_subreddit_qs.values( 'id' )