Exemple #1
0
def hunter(first_name, last_name, company_name, API):
    hunter = PyHunter(API)
    email = ""
    score = 0
    email, score = hunter.email_finder(first_name=first_name,
                                       last_name=last_name,
                                       company=company_name)
    if type(email) != type(""):
        email = 'PERSON NOT FOUND'
        print('PERSON NOT FOUND')
    if type(score) != type(0):
        score = -1
    return email, score
def email_finder(company, name):
    print ('domain name found by clearbit:', company)
    if company is not None :
        '''You can also use the company name and the full name instead, along with raw to get the full response:'''
        hunter = PyHunter('a890302fd13f718af83604989dbd3213772a0d07')
        json_load = json.loads(hunter.email_finder(company= company, full_name= name, raw = True).text)
        email = json_load['data']['email']
        score = json_load['data']['score']
        position = json_load['data']['position']
        first_name = json_load['data']['first_name']
        last_name = json_load['data']['last_name']
        return email, score, position, first_name, last_name
    else:
        return None, None, None, None, None
Exemple #3
0
def get_email(row):
    hunter = PyHunter(os.environ.get('HUNTER_API_KEY'))
    suggested_email = None
    confidence_score = None
    try:
        suggested_email, confidence_score = hunter.email_finder(
            company=row['employeecompany'],
            first_name=row['firstname'],
            last_name=row['lastname'])
    except HTTPError:
        pass
    if confidence_score is not None and confidence_score > CONFIDENCE_THRESHOLD:
        return suggested_email
    else:
        return None
Exemple #4
0
    def find_email(self, name, d_name):
        # creating a hunter object
        hunter = PyHunter(self.key)

        #proper capitalization of the name
        name = " ".join([i.capitalize() for i in name.split(" ")])

        #calling api to fetch email and confidency score
        try:
            email, c_score = hunter.email_finder(domain=d_name, full_name=name)
            #rasing exception when non type in returned
            if email == None:
                raise ValueError
        except BaseException:
            email, c_score = ('NotFound', 0)

        return email, c_score
Exemple #5
0
 def run(self, conf, args, plugins):
     if 'subcommand' in args:
         hunter = PyHunter(conf['Hunter']['key'])
         if args.subcommand == 'email':
             if ' ' not in args.NAME:
                 print('Name should contains first and last name')
                 print('(Yes this API is useless)')
                 sys.exit(1)
             res = hunter.email_finder(
                 domain=args.DOMAIN,
                 full_name=args.NAME,
                 raw=True
             )
             print(json.dumps(res, sort_keys=True, indent=4))
         elif args.subcommand == 'domain':
             res = hunter.domain_search(args.DOMAIN)
             print(json.dumps(res, sort_keys=True, indent=4))
         else:
             self.parser.print_help()
     else:
         self.parser.print_help()
Exemple #6
0
def main():
    linkedin_username = os.getenv("LINKEDIN_USER")
    linkedin_passkey = os.getenv("LINKEDIN_PASS")
    hunter_apikey = os.getenv("HUNTER_API")
    chromedriver_dir = os.getenv("CHROMEDRIVER")

    listing_url = input(
        "Welcome to Recruit_Link!  Please enter a job listing's LinkedIn url:\n"
    )
    name, title, profile, company, company_website, job_title = \
        find_contact(listing_url, linkedin_username, linkedin_passkey, chromedriver_dir)
    company_website = company_website.replace("bit.ly",
                                              f"{company}.com").replace(
                                                  "/careers", "")
    print(f"Now searching for: {name.strip()}, {title.strip()}\n")

    email_message = f"Hi {name.split()[0]},\n" \
              f"\n" \
              f"I hope this email finds you well.  I just recently saw a posting for a {job_title} position at {company}" \
              f" and would love to learn more.  My experience with Python, SQL, SKILLS HERE feels like a great fit for " \
                    f"the role.\n" \
              f"\n" \
              f"Could you tell me more about the data science team and what it's like to work for the company?  " \
              f"I believe you would have great insight as a {title.strip()} for {company}.\n" \
              f"\n" \
              f"I appreciate any information you could provide, looking forward to hearing from you!\n" \
              f"\n" \
              f"Thank you,\n" \
              f"\n"

    linkedin_message = f"Hi {name.split()[0]}, I recently saw a {job_title} position at {company} and I wanted " \
                       f"to learn more about your company! My experience with Python, SQL, FILL feels like a great fit " \
                       f"for the role. Would love any more information you have, thanks!"

    name = name.lower()
    company_email = company_website.replace("https://www.", "@")\
                                   .replace("http://www.", "@")\
                                   .replace("http:", "@")\
                                   .replace("https:", "@")\
                                   .replace("jobs.", "")\
                                   .replace(r"\.com.*$", ".com")\
                                   .replace("/", "")
    patterns = [
        "finitiallast", "finitial.last", "firstlast", "first.last", "first",
        "last", "firstlinitial", "first.linitial", "first_linitial",
        "finitial_last"
    ]
    patterns = [
        pattern.replace("first",
                        name.split()[0]).replace(
                            "last",
                            name.split()[-1]).replace(
                                "finitial",
                                name.split()[0][0]).replace(
                                    "linitial",
                                    name.split()[-1][0]) + company_email
        for pattern in patterns
    ]

    hunter = PyHunter(hunter_apikey)  # Hunter API Key here
    hunter_email, confidence_score = hunter.email_finder(company_website,
                                                         full_name=name)
    if hunter_email:
        emails = [hunter_email] + patterns
    else:
        emails = patterns

    for email in emails:
        print(f"Checking {email}...")
        try:
            verification = hunter.email_verifier(email)
        except:
            continue
        if verification['result'] == 'deliverable':
            print("Success, found the following email:\n")
            print(email)
            pyperclip.copy(email_message)
            print("Message pasted to clipboard.")
            exit()
        elif email == emails[-1]:
            print(f"Email search failed, try to contact on LinkedIn:\n"
                  f"{profile}")
            pyperclip.copy(linkedin_message)
            print("Message pasted to clipboard.")
            exit()
        else:
            continue
Exemple #7
0
    infile = input("Location of URLs file..")
    outfile = input("Location of output text file..")
    fopen = open(outfile, 'w')
    with open(infile) as f:
        for i in f:
            x = i.rstrip('\n')
            url = x
            print(url)
            results = hunter.domain_search(url)
            printed = json.dumps(results)
            fopen.write(printed)
    fopen.close()
elif (args.fns):
    company1 = input("Enter company of interest..")
    name = input("Enter person of interest")
    results = hunter.email_finder(company=company1, full_name=name, raw=True)
    print(results)
elif (args.v):
    validatepls = input("File with Email addresses to validate..")
    outfile = input("Location of output text file..")
    fopen = open(outfile, 'w')
    with open(validatepls) as f:
        for i in f:
            x = i.rstrip('\n')
            print(x)
            emailname = x
            print(emailname)
            validated = hunter.email_verifier(emailname)
            printed = json.dumps(validated)
            fopen.write(emailname)
            fopen.write('\n')
Exemple #8
0
hunter = PyHunter('016a2e85a4fd5bc142c055c42cb60954fc1710df')


#option 1:
try:
	with open('rail-shipper.csv', 'r', encoding='utf-8') as csvfile:
		csvreader = csv.reader(csvfile)
		next(csvreader)
		for row in csvreader:
	    	#extracting the name and company name from the csv file
			"""
			#if list has first and last name:
			first_name = row[0]
			last_name = row[1]
			name = row[0] + " " + row[1]
			company_name = row[2] 
			"""
			name = row[0].encode('utf8')
			name_tokens = name.split()
			domain = row[3]
			if "facebook" in domain:
				continue
			#sys.stdout.buffer.write(name)
			#print(":")
			#print(domain)
	    	#printing the results:
			email, confidence_score = hunter.email_finder(domain, full_name=name)
			print(email)
except:
	print("ERROR in option 1", sys.infp())