Skip to content

Commit

Permalink
second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewzhang451 committed Nov 23, 2024
1 parent 35ab45b commit a4c20d9
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 70 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Execution Flow:
Final Setup and Execution:

1. Generate Cover Letter: Run generate_cover_letter.py to create a personalized cover letter.
2. Fill Application Form: Run autofill_form.py to automatically fill and submit the application form.
3. Log the Application: Run log_applications.py to save the details to applications.csv.
1. Edit site_config.json to add field mappings for new application forms.
2. Run generate_cover_letter.py to create a tailored cover letter.
3. Run autofill_form.py to submit applications.
4. Run log_applications.py to log the application details.
5. This setup ensures compatibility with most application forms, allows flexibility for custom sites, and simplifies the application process.
28 changes: 28 additions & 0 deletions config/site-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"default": {
"url": "https://example.com/application-form",
"fields": {
"name": "name_field_id",
"email": "email_field_id",
"phone": "phone_field_id",
"linkedin": "linkedin_field_id",
"github": "github_field_id",
"resume_upload": "resume_field_id",
"cover_letter_upload": "cover_letter_field_id"
},
"submit_button": "submit_button_id"
},
"example_site": {
"url": "https://example2.com/apply",
"fields": {
"name": "full_name",
"email": "contact_email",
"phone": "contact_phone",
"linkedin": "linkedin_profile",
"github": "github_profile",
"resume_upload": "resume_upload_input",
"cover_letter_upload": "cover_letter_upload_input"
},
"submit_button": "apply_now_button"
}
}
Binary file added data/Andrew_Zhang_Resume.pdf
Binary file not shown.
Empty file added data/cover_letter.pdf
Empty file.
6 changes: 4 additions & 2 deletions data/resume_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "Andrew Zhang",
"email": "[email protected]",
"phone": "773-791-2909",
"linkedin": "linkedin.com/in/andrew-zhang-b59a7b210/",
"github": "github.com/andrewzhang451"
"linkedin": "https://linkedin.com/in/andrew-zhang-b59a7b210/",
"github": "https://github.com/andrewzhang451",
"resume": "../data/Andrew_Zhang_Resume.pdf",
"cover_letter": "../data/cover_letter.pdf"
}
43 changes: 25 additions & 18 deletions scripts/autofill_form.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
import json

# Load resume info
# Load configurations
with open("../config/site_config.json", "r") as file:
site_config = json.load(file)
with open("../data/resume_info.json", "r") as file:
resume_info = json.load(file)
personal_info = json.load(file)

# Initialize WebDriver
driver = webdriver.Chrome(executable_path="/path/to/chromedriver")
def fill_form(site_key):
config = site_config[site_key]
fields = config["fields"]

# Open the application form
driver.get("https://application-form-link.com")
driver = webdriver.Chrome(executable_path="/path/to/chromedriver")
driver.get(config["url"])

# Fill in the form
driver.find_element(By.ID, "name").send_keys(resume_info["name"])
driver.find_element(By.ID, "email").send_keys(resume_info["email"])
driver.find_element(By.ID, "linkedin").send_keys(resume_info["linkedin"])
driver.find_element(By.ID, "github").send_keys(resume_info["github"])
driver.find_element(By.ID, "resume_upload").send_keys("../data/Andrew_Zhang_Resume.pdf")
driver.find_element(By.ID, "cover_letter_upload").send_keys("../data/cover_letter_TechCorp.pdf")
# Fill out the form
driver.find_element(By.ID, fields["name"]).send_keys(personal_info["name"])
driver.find_element(By.ID, fields["email"]).send_keys(personal_info["email"])
driver.find_element(By.ID, fields["phone"]).send_keys(personal_info["phone"])
driver.find_element(By.ID, fields["linkedin"]).send_keys(personal_info["linkedin"])
driver.find_element(By.ID, fields["github"]).send_keys(personal_info["github"])
driver.find_element(By.ID, fields["resume_upload"]).send_keys(personal_info["resume"])
driver.find_element(By.ID, fields["cover_letter_upload"]).send_keys(personal_info["cover_letter"])

# Submit the form
driver.find_element(By.ID, "submit").click()
input("Complete any captchas or manual steps, then press Enter to continue...")

print("Application form submitted successfully!")
# Submit the form
driver.find_element(By.ID, config["submit_button"]).click()
print("Form submitted successfully!")
driver.quit()

driver.quit()
# Example usage
fill_form("default")
39 changes: 27 additions & 12 deletions scripts/generate_cover_letter.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
import json
from jinja2 import Template

# Load resume info
# Load personal information
with open("../data/resume_info.json", "r") as file:
resume_info = json.load(file)

# Load cover letter template
with open("../templates/cover_letter_template.txt", "r") as file:
template = Template(file.read())
# Cover letter template
template_text = """
Dear {{ recruiter_name }},
# Fill details dynamically
I am thrilled to apply for the {{ job_title }} position at {{ company_name }}. With a strong foundation in {{ key_skills }} and hands-on experience in {{ projects }}, I am confident in my ability to excel in this role.
As an Event Manager at Illinois Institute of Technology, I led teams and ensured seamless event execution. My technical expertise, showcased in projects like {{ notable_project }}, demonstrates my ability to deliver impactful solutions.
I would be delighted to bring my skills in {{ relevant_skills }} to your team. Please feel free to contact me at {{ email }} or {{ phone }}.
Thank you for considering my application.
Sincerely,
{{ name }}
"""

template = Template(template_text)

# Fill in placeholders
data = {
"recruiter_name": "Hiring Manager",
"job_title": "Software Engineering Intern",
"company_name": "Tech Corp",
"key_skills": "React, TypeScript, SQL, and Appwrite",
"technologies_used": "React, Tailwind CSS, Python, SQL",
"relevant_skills": "full-stack development, API integration, and database management",
"key_skills": "React, Python, SQL, and Vue.js",
"projects": "social media app development and inventory management systems",
"notable_project": "Social Media App",
"relevant_skills": "full-stack development and API integration",
**resume_info
}

# Generate cover letter
# Generate the cover letter
cover_letter = template.render(data)

# Save to a file
output_file = "../data/cover_letter_TechCorp.pdf"
# Save the cover letter
output_file = "../data/cover_letter.pdf"
with open(output_file, "w") as file:
file.write(cover_letter)

print(f"Cover letter saved to {output_file}")
print(f"Cover letter saved at {output_file}")
46 changes: 24 additions & 22 deletions scripts/log_applications.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import csv
from datetime import datetime

# Log data
application_data = {
"Company Name": "Tech Corp",
"Job Title": "Software Engineering Intern",
"Application Link": "https://application-form-link.com",
"Status": "Submitted",
"Notes": "Follow-up in 2 weeks"
}
def log_application(company_name, job_title, application_url, status="Submitted"):
log_file = "../applications.csv"
fields = ["Date", "Company Name", "Job Title", "Application URL", "Status"]

# Write to CSV
file_name = "../applications.csv"
fields = ["Company Name", "Job Title", "Application Link", "Status", "Notes"]
data = {
"Date": datetime.now().strftime("%Y-%m-%d"),
"Company Name": company_name,
"Job Title": job_title,
"Application URL": application_url,
"Status": status
}

try:
with open(file_name, "a", newline="") as file:
writer = csv.DictWriter(file, fieldnames=fields)
writer.writerow(application_data)
except FileNotFoundError:
# Create a new file if not existing
with open(file_name, "w", newline="") as file:
writer = csv.DictWriter(file, fieldnames=fields)
writer.writeheader()
writer.writerow(application_data)
try:
with open(log_file, "a", newline="") as file:
writer = csv.DictWriter(file, fieldnames=fields)
writer.writerow(data)
except FileNotFoundError:
with open(log_file, "w", newline="") as file:
writer = csv.DictWriter(file, fieldnames=fields)
writer.writeheader()
writer.writerow(data)

print("Application logged successfully!")
print(f"Application logged for {company_name} - {job_title}")

# Example usage
log_application("Tech Corp", "Software Engineering Intern", "https://example.com/application-form")
12 changes: 0 additions & 12 deletions templates/cover_letter_template.txt

This file was deleted.

0 comments on commit a4c20d9

Please sign in to comment.