コード例 #1
0
ファイル: Main.py プロジェクト: treerachai/instabot
def run():
    session = Driver()
    mailer = Mailer()
    while True:
        try:
            mailer.send(
                "Instagram Bot started. Please send >>Start<< to start")
            loop()
        except socket_error as err:
            if err.errno != errno.ECONNREFUSED:
                raise err
            else:
                session = Driver()
                mailer = Mailer()
コード例 #2
0
ファイル: Main.py プロジェクト: treerachai/instabot
def loop():
    session = Driver()
    mailer = Mailer()
    while True:
        message = mailer.get_current_message()
        if (message == "Start" or message == "Continue"):
            try:
                session.like_follow_loop()

            except KeyboardInterrupt:
                mailer.send("Keyboard Interrupt. Bot will exit now.")
                print("Exiting...")
                break
            except socket_error as err:
                raise err
            except Exception as err:
                for frame in traceback.extract_tb(sys.exc_info()[2]):
                    fname, lineno, fn, text = frame
                error = "Error in " + str(fname) + " on line " + str(
                    lineno) + ": " + str(err)
                print(error)
                mailer.send(error)
                pass
        else:
            if (message == "Stop" or message == "Exit"):
                mailer.send("Instagram Bot will exit now.")
                break
            sleep(1)
コード例 #3
0
 def send(self, subject, content):
     config = ConfigObj("mail.conf", encoding='UTF8')
     mail = Mailer(config['mail.smtp']['addr'],
                   config['mail.smtp']['password'],
                   config['mail.smtp']['smtp'], config['mail.smtp']['port'],
                   '*****@*****.**')
     res = mail.mail(subject, content)
     print(res)
コード例 #4
0
 def __init__(self):
     with open("sitelog/log.pickle", "rb") as logfile:
         self.log = pickle.load(logfile)
     self.mailer = Mailer()
     self.url = "https://www.google.de/search?q={}#q={}&start={}"
     self.browser = webdriver.PhantomJS(desired_capabilities=dcap)
     self.headlines_xpath = ".//*[@class='r']"
     self.targets = {
         "Philipp Matthes: Imagination Realization": "philipp+matthes"
     }
コード例 #5
0
    def __init__(self):
        # Set up Telegram Message Client
        self.mailer = Mailer()

        # Set up virtual display
        if Config.headless_is_available:
            self.display = Xvfb()
            self.display.start()

        # Load history
        try:
            with open("log/followed_users_all_time.pickle", "rb") as f:
                self.followed_accounts = pickle.load(f)
        except:
            with open("log/followed_users_all_time.pickle", "wb") as f:
                self.followed_accounts = {}
                pickle.dump({}, f)
        try:
            with open("log/followed_users.pickle", "rb") as f:
                self.accounts_to_unfollow = pickle.load(f)
        except:
            with open("log/followed_users.pickle", "wb") as f:
                self.accounts_to_unfollow = []
                pickle.dump([], f)

        try:
            with open("log/instagram_username.pickle", "rb") as f:
                self.username = pickle.load(f)
        except:
            key = input("Please enter your username: "******"You must enter a username. Please try again: ")
            with open("log/instagram_username.pickle", "wb") as f:
                pickle.dump(key, f)
            self.username = key
        try:
            with open("log/instagram_pass.pickle", "rb") as f:
                self.password = pickle.load(f)
        except:
            key = input("Please enter your password: "******"You must enter a password. Please try again: ")
            with open("log/instagram_pass.pickle", "wb") as f:
                pickle.dump(key, f)
            self.password = key

        # Final setup
        if Config.headless_is_available:
            self.browser = webdriver.PhantomJS()
        else:
            self.browser = webdriver.Chrome()
        self.browser.set_window_size(1980, 1080)
コード例 #6
0
    def __init__(self):
        # Set up Telegram Message Client
        self.mailer = Mailer()
        if self.mailer.getCurrentMessage() == "Stop":
            raise Exception('Stopped by telegram.')
        self.mailer.sendMessage("Initializing FacebookDriver.")

        Set up virtual display for Raspberry Pi compatibility
        self.display = Xvfb()
        self.display.start()

        # The following (xpath) classes need to be refreshed every now and then.
        # they define, where elements are located on Facebook.

        # Logging in
        self.loginXpath = "//input[@id='email']"
        self.passwordXpath = "//input[@id='pass']"
        # Elements on the hashtag page
        self.containerXpath = "//div[contains(@class, '_1dwg _1w_m')]"
        self.userNameSubXpath = "//span[contains(@class, 'fwb fcg')]"
        # Alias selection
        self.menuSubXpath = "//div[contains(@class, '_8g2')]"
        self.aliasSelectionSubXpath = ".//a[contains(@class, '_55pi _2agf _4o_4 _4jy0 _4jy3 _517h _51sy _59pe _42ft')]"
        self.companySelectionSubXpath = "//div[contains(@class, '_5ghu _alf')]"
        self.alldaycreativeSelectionSubXpath = "//div[contains(@class, ' _5dsl _alf clearfix')]"
        # Commenting
        self.commentButtonSubXpath = "//a[contains(@class, 'comment_link _5yxe')]"
        self.commentInputSubXpath = "//div[contains(@class, '_1p1v')]"
        # Liking
        self.likeButtonSubXpath = "//a[@class='UFILikeLink _4x9- _4x9_ _48-k']"
        self.likeButtonClickedSubXpath = "//a[contains(@class, 'UFILikeLink _4x9- _4x9_ _48-k UFILinkBright')]"


        self.login = input("E-Mail: ")
        self.password = input("Password: "******"render","cartoon","daily","art","design","cinema4d","animation","cg","illustration"]
        self.delay = 30
        self.startUrl = "https://www.facebook.com/login.php"
        self.hashtagPage = "https://www.facebook.com/hashtag/{}"

        # chrome_options = webdriver.ChromeOptions()
        # prefs = {"profile.default_content_setting_values.notifications" : 2}
        # chrome_options.add_experimental_option("prefs",prefs)
        # self.browser = webdriver.Chrome(chrome_options=chrome_options)
        self.browser = webdriver.PhantomJS()
        self.browser.set_window_size(1920,1080)
        self.log = []
コード例 #7
0
ファイル: SPSWatcher.py プロジェクト: AdamVerner/SPSWatcher
    def __init__(self):

        self.log = logging.getLogger(__name__)

        self.http = urllib3.PoolManager()

        if not os.path.exists(os.path.dirname(self.save_folder)):
            os.mkdir(os.path.dirname(self.save_folder))

        self.log.info('current day is %s', datetime.now().isoformat())
        self.log.info('saving to folder : %s', os.path.abspath(self.save_folder))
        self.log.info('look_forward set to %d days', self.look_forward)

        self.mailer = Mailer(self.log)
コード例 #8
0
ファイル: main.py プロジェクト: georgeneokq/face-fun
# Load detectors
print("[INFO] loading model...")
# net = cv2.dnn.readNetFromCaffe('models/face_detection/deploy.prototxt.txt, 'models/face_detection/res10_300x300_ssd_iter_140000.caffemodel')
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(
    'models/facial_landmark_prediction/shape_predictor_68_face_landmarks.dat')

# Create screenshots folders if not yet created
screenshots_folder_name = getenv('SCREENSHOTS_FOLDER')
if not os.path.isdir(screenshots_folder_name):
    os.mkdir(screenshots_folder_name)

show_help = False

# Set up SMTP for sending screenshots by email
mailer = Mailer(getenv("MAIL_ADDRESS"), getenv("MAIL_PW"))

# Cache list of drawables
categories = getCategoryNames()
current_category = categories[0]
current_category_index = 0
category_item_count = getCategoryItemCount(current_category)

# Change drawable based on blink count
drawableIndex = 0


def nextCategory():
    global current_category_index, current_category, category_item_count, drawableIndex
    current_category_index += 1
    if current_category_index >= len(categories):
コード例 #9
0
from Mailer import Mailer
import time

# python-os-environ-object
mail_configuration = {
    'from': '',  # From mail account
    'to': '',  # Receiver @dinahosting.com account
    'server': '',  # From mail server
    'pwd': '',  # From mail password
    'port': '',  # From port
    'subject': ''  # Mail subject
}

feng_configuration = {
    'user': '',  # Feng user
    'pwd': '',  # Feng password
    'domain': ''  # Feng domain
}

feng_client = Client(feng_configuration['user'], feng_configuration['pwd'],
                     feng_configuration['domain'])
mail_client = Mailer(mail_configuration['from'], mail_configuration['to'],
                     mail_configuration['server'], mail_configuration['pwd'],
                     mail_configuration['port'], mail_configuration['subject'])

while True:
    tasks = feng_client.getTasks()
    if tasks:
        mail_client.send(tasks)
    time.sleep(600)
コード例 #10
0
ファイル: Main.py プロジェクト: elijahhezekiah12/facebot
from FacebookDriver import Driver
from Mailer import Mailer
from time import sleep
import traceback
import sys

if __name__ == "__main__":
    session = Driver()
    mailer = Mailer()
    mailer.sendMessage("Facebook Bot started. Please send >>Start<< to start")
    while True:
        message = mailer.getCurrentMessage()
        if (message == "Start" or message == "Continue"):
            try:
                session.doSomeMagic()
            # except Exception as err:
            #     for frame in traceback.extract_tb(sys.exc_info()[2]):
            #         fname, lineno, fn, text = frame
            #     error = "Error in "+str(fname)+" on line "+str(lineno)+": "+str(err)
            #     print(error)
            #     mailer.sendMessage(error)
            #     pass
            except KeyboardInterrupt:
                mailer.sendMessage("Keyboard Interrupt. Bot will exit now.")
                print("Exiting...")
                break
        else:
            if (message == "Stop" or message == "Exit"):
                mailer.sendMessage("Facebook Bot will exit now.")
                break
            sleep(1)
コード例 #11
0
from EmployeeDataReader import EmployeeDataReader
from MailBody import MailBody
from Mailer import Mailer
from Constants import Constants
import sys
import os

if __name__ == '__main__':
    empdata_reader = EmployeeDataReader(Constants.MAPPING_FILE)
    header, employee_data_list = empdata_reader.read()
    sender = raw_input(
        "Enter mail_id of sender(Eg: <asdf>@thoughtworks.com) : ")
    mailer = Mailer(sender)
    e = None
    try:
        employees_without_bill_file = []
        for employee_data in employee_data_list:
            bill_file_name = Constants.BILLS_DIR + os.sep + "%s.pdf" % employee_data.mobile_number
            if os.path.exists(bill_file_name):
                mailer.send_mail(
                    ('*****@*****.**' % employee_data.employee_id),
                    'Your bill for the month between %s and %s' %
                    (employee_data.start_date, employee_data.end_date),
                    MailBody(header, employee_data).html(), bill_file_name)
            else:
                employees_without_bill_file.append(employee_data)
        new_header = ["employee_id", "name", "mobile_number"]
        if len(employees_without_bill_file) > 0:
            mailer.send_mail(
                sender, 'Employees who did not get their bill',
                MailBody(new_header, employees_without_bill_file).html())
コード例 #12
0
 def actionListener_suite(self):
     if (self.mail.getDestinataires().__len__() > 0):
         self.destroy()
         Mailer(self.mail)
コード例 #13
0
ファイル: AWSService.py プロジェクト: vligade/lazy-devops
s3_user = raw_input("Enter The S3 Username: "******"Bucket cannot be created or it already exists"
else:
    iam.create_user(s3_user)

user_info = iam.access_key(s3_user)

created_user = user_info[0]
created_access_key = user_info[1]
created_secret_key = user_info[2]

iam.attach_policy(s3_user, bucket_name)

filepath = FileCreator.create_s3_file(bucket_name, created_user,
                                      created_access_key, created_secret_key)

body = "Hello there.."
mailer = Mailer("*****@*****.**", "Your bucket details", body,
                filepath, "s3details.txt")
mailer.attach_attachment()
mailer.send_mail()

print "S3 Bucket: %s" % bucket_name
print "S3 Username: %s" % created_user
print "Access Key Id: %s" % created_access_key
print "Aws Secret Access Key: %s" % created_secret_key
コード例 #14
0
ファイル: Driver.py プロジェクト: hassansalehe/deHunter
 def __init__(self):
     self.timestep_secs = 10
     self.searcher = Searcher()
     self.composer = Composer()
     self.mailer = Mailer()
コード例 #15
0
from Mailer import Mailer
from configobj import ConfigObj

config = ConfigObj("mail.conf", encoding='UTF8')
mail = Mailer(config['mail.smtp']['addr'], config['mail.smtp']['password'],
              config['mail.smtp']['smtp'], config['mail.smtp']['port'],
              '*****@*****.**')
res = mail.mail('test mail', 'i am a test mail')
print(res)