From daf7f74c801a2715af35e0a838b184b3a964be1a Mon Sep 17 00:00:00 2001 From: Riddhima Deshmukh <115169787+ridds-io@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:57:38 +0530 Subject: [PATCH 01/10] Updated main.py Fixed the following issue: # 494 BUG ALL JOBS APPLIED TO Mid-Senior level EVEN AFTER SETTING IT TO FALSE Key Fixes: Corrected Configuration Validation for experienceLevel: The function now ensures that experienceLevel values are correctly handled as booleans. More Selective Error Suppression: Only suppress stderr in specific blocks to avoid hiding critical errors. Improved Exception Handling: Refined the exception handling blocks to catch more specific exceptions. Removed Unused Imports: Cleaned up unused imports like os, sys, and StyleManager. General Cleanup: Added missing checks for file paths and configurations. --- main.py | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/main.py b/main.py index 79d48ccb6..1399f13de 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager from selenium.common.exceptions import WebDriverException -from lib_resume_builder_AIHawk import Resume,StyleManager,FacadeManager,ResumeGenerator +from lib_resume_builder_AIHawk import Resume, FacadeManager, ResumeGenerator from src.utils import chrome_browser_options from src.llm.llm_manager import GPTAnswerer from src.aihawk_authenticator import AIHawkAuthenticator @@ -17,8 +17,8 @@ from src.job_application_profile import JobApplicationProfile from loguru import logger -# Suppress stderr -sys.stderr = open(os.devnull, 'w') +# Suppress stderr only during specific operations +original_stderr = sys.stderr class ConfigError(Exception): pass @@ -37,8 +37,8 @@ def validate_yaml_file(yaml_path: Path) -> dict: raise ConfigError(f"Error reading file {yaml_path}: {exc}") except FileNotFoundError: raise ConfigError(f"File not found: {yaml_path}") - - + + @staticmethod def validate_config(config_yaml_path: Path) -> dict: parameters = ConfigValidator.validate_yaml_file(config_yaml_path) required_keys = { @@ -67,30 +67,36 @@ def validate_config(config_yaml_path: Path) -> dict: else: raise ConfigError(f"Invalid type for key '{key}' in config file {config_yaml_path}. Expected {expected_type}.") + # Validate experience levels, ensure they are boolean experience_levels = ['internship', 'entry', 'associate', 'mid-senior level', 'director', 'executive'] for level in experience_levels: if not isinstance(parameters['experienceLevel'].get(level), bool): raise ConfigError(f"Experience level '{level}' must be a boolean in config file {config_yaml_path}") + # Validate job types, ensure they are boolean job_types = ['full-time', 'contract', 'part-time', 'temporary', 'internship', 'other', 'volunteer'] for job_type in job_types: if not isinstance(parameters['jobTypes'].get(job_type), bool): raise ConfigError(f"Job type '{job_type}' must be a boolean in config file {config_yaml_path}") + # Validate date filters date_filters = ['all time', 'month', 'week', '24 hours'] for date_filter in date_filters: if not isinstance(parameters['date'].get(date_filter), bool): raise ConfigError(f"Date filter '{date_filter}' must be a boolean in config file {config_yaml_path}") + # Validate positions and locations as lists of strings if not all(isinstance(pos, str) for pos in parameters['positions']): raise ConfigError(f"'positions' must be a list of strings in config file {config_yaml_path}") if not all(isinstance(loc, str) for loc in parameters['locations']): raise ConfigError(f"'locations' must be a list of strings in config file {config_yaml_path}") + # Validate distance approved_distances = {0, 5, 10, 25, 50, 100} if parameters['distance'] not in approved_distances: raise ConfigError(f"Invalid distance value in config file {config_yaml_path}. Must be one of: {approved_distances}") + # Ensure blacklists are lists for blacklist in ['companyBlacklist', 'titleBlacklist']: if not isinstance(parameters.get(blacklist), list): raise ConfigError(f"'{blacklist}' must be a list in config file {config_yaml_path}") @@ -99,10 +105,8 @@ def validate_config(config_yaml_path: Path) -> dict: return parameters - - @staticmethod - def validate_secrets(secrets_yaml_path: Path) -> tuple: + def validate_secrets(secrets_yaml_path: Path) -> str: secrets = ConfigValidator.validate_yaml_file(secrets_yaml_path) mandatory_secrets = ['llm_api_key'] @@ -115,10 +119,6 @@ def validate_secrets(secrets_yaml_path: Path) -> tuple: return secrets['llm_api_key'] class FileManager: - @staticmethod - def find_file(name_containing: str, with_extension: str, at_path: Path) -> Path: - return next((file for file in at_path.iterdir() if name_containing.lower() in file.name.lower() and file.suffix.lower() == with_extension.lower()), None) - @staticmethod def validate_data_folder(app_data_folder: Path) -> tuple: if not app_data_folder.exists() or not app_data_folder.is_dir(): @@ -150,7 +150,6 @@ def file_paths_to_dict(resume_file: Path | None, plain_text_resume_file: Path) - def init_browser() -> webdriver.Chrome: try: - options = chrome_browser_options() service = ChromeService(ChromeDriverManager().install()) return webdriver.Chrome(service=service, options=options) @@ -159,15 +158,15 @@ def init_browser() -> webdriver.Chrome: def create_and_run_bot(parameters, llm_api_key): try: - style_manager = StyleManager() + style_manager = FacadeManager.StyleManager() resume_generator = ResumeGenerator() with open(parameters['uploads']['plainTextResume'], "r", encoding='utf-8') as file: plain_text_resume = file.read() resume_object = Resume(plain_text_resume) resume_generator_manager = FacadeManager(llm_api_key, style_manager, resume_generator, resume_object, Path("data_folder/output")) - os.system('cls' if os.name == 'nt' else 'clear') + + # Run the resume generator manager's functions resume_generator_manager.choose_style() - os.system('cls' if os.name == 'nt' else 'clear') job_application_profile_object = JobApplicationProfile(plain_text_resume) @@ -203,19 +202,14 @@ def main(resume: Path = None): create_and_run_bot(parameters, llm_api_key) except ConfigError as ce: logger.error(f"Configuration error: {str(ce)}") - logger.error(f"Refer to the configuration guide for troubleshooting: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration {str(ce)}") + logger.error(f"Refer to the configuration guide for troubleshooting.") except FileNotFoundError as fnf: logger.error(f"File not found: {str(fnf)}") logger.error("Ensure all required files are present in the data folder.") - logger.error("Refer to the file setup guide: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration") except RuntimeError as re: - logger.error(f"Runtime error: {str(re)}") - - logger.error("Refer to the configuration and troubleshooting guide: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration") except Exception as e: logger.error(f"An unexpected error occurred: {str(e)}") - logger.error("Refer to the general troubleshooting guide: https://github.com/feder-cr/AIHawk_AIHawk_automatic_job_application/blob/main/readme.md#configuration") if __name__ == "__main__": main() From 8abdfd5c60a1fd0e8e8999dfc085a8b9b6a7e4fc Mon Sep 17 00:00:00 2001 From: ksdata <41391415+0xksdata@users.noreply.github.com> Date: Fri, 11 Oct 2024 23:14:45 -0400 Subject: [PATCH 02/10] Update resume_schema.yaml fixed grammatical error --- assets/resume_schema.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/resume_schema.yaml b/assets/resume_schema.yaml index 25ddfff31..8b3bb88ad 100644 --- a/assets/resume_schema.yaml +++ b/assets/resume_schema.yaml @@ -15,7 +15,7 @@ personal_information: email: {type: string, format: email} github: {type: string, format: uri} linkedin: {type: string, format: uri} - required: [name, surname, date_of_birth, country, city, address,zip_code, phone_prefix, phone, email] + required: [name, surname, date_of_birth, country, city, address, zip_code, phone_prefix, phone, email] education_details: type: array @@ -130,4 +130,4 @@ work_preferences: willing_to_complete_assessments: {type: string, enum: [Yes, No]} willing_to_undergo_drug_tests: {type: string, enum: [Yes, No]} willing_to_undergo_background_checks: {type: string, enum: [Yes, No]} - required: [remote_work, in_person_work, open_to_relocation, willing_to_complete_assessments, willing_to_undergo_drug_tests, willing_to_undergo_background_checks] \ No newline at end of file + required: [remote_work, in_person_work, open_to_relocation, willing_to_complete_assessments, willing_to_undergo_drug_tests, willing_to_undergo_background_checks] From 20362f2b5b16b567f259daba09ba4c0eebfee22f Mon Sep 17 00:00:00 2001 From: ksdata <41391415+0xksdata@users.noreply.github.com> Date: Fri, 11 Oct 2024 23:16:20 -0400 Subject: [PATCH 03/10] Update config.yaml fixed grammatical error --- data_folder/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_folder/config.yaml b/data_folder/config.yaml index f114bb0eb..90674e812 100644 --- a/data_folder/config.yaml +++ b/data_folder/config.yaml @@ -47,4 +47,4 @@ job_applicants_threshold: llm_model_type: openai llm_model: 'gpt-4o-mini' -# llm_api_url: https://api.pawan.krd/cosmosrp/v1' +# llm_api_url: 'https://api.pawan.krd/cosmosrp/v1' From b51f5ca899249216b9cbd9f1be79ae1614787242 Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:15:57 +0200 Subject: [PATCH 04/10] Update LICENSE --- LICENSE | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index edae2b3c1..ced8624b6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,22 @@ -MIT License +# **Proprietary License for Auto Jobs Applier AIHawk** -Copyright (c) 2024 feder-cr +## 1. **Ownership** +The software, titled **Auto Jobs Applier AIHawk**, is the exclusive property of **Federico Elia** (hereinafter referred to as "Author"). All rights, titles, and interests in this software are reserved to the Author. -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +## 2. **Restrictions on Use** +You may not use, copy, modify, distribute, or create derivative works from the software without the **prior written consent of the Author**. -The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. +## 3. **Request for Authorization** +Any third party wishing to use, modify, copy, or distribute the software must submit a **request for authorization** to the Author. The request should be sent to Federico Elia. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +## 4. **Conditions of Authorization** +The Author reserves the right to grant or deny authorization at their discretion. Any granted authorization will be subject to the terms and conditions set forth by the Author. + +## 5. **Prohibition of Unauthorized Use** +Any unauthorized use of the software will be considered a **violation of copyright** and may be subject to legal action under applicable laws. + +## 6. **Warranties and Liability** +The software is provided "as is," without any warranties of any kind, express or implied. The Author shall not be liable for any damages arising from the use or inability to use the software. + +## 7. **Governing Law** +This agreement shall be governed by the laws of Italy, without regard to its conflict of law provisions. From 4284b6a3af9f53df6e8bf094d45b13f0813ed0df Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:17:53 +0200 Subject: [PATCH 05/10] Update LICENSE --- LICENSE | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/LICENSE b/LICENSE index ced8624b6..0e39673ec 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,22 @@ -# **Proprietary License for Auto Jobs Applier AIHawk** +Proprietary License for Auto Jobs Applier AIHawk -## 1. **Ownership** -The software, titled **Auto Jobs Applier AIHawk**, is the exclusive property of **Federico Elia** (hereinafter referred to as "Author"). All rights, titles, and interests in this software are reserved to the Author. +1)Ownership +The software, titled Auto Jobs Applier AIHawk, is the exclusive property of Federico Elia (hereinafter referred to as "Author"). All rights, titles, and interests in this software are reserved to the Author. -## 2. **Restrictions on Use** -You may not use, copy, modify, distribute, or create derivative works from the software without the **prior written consent of the Author**. +2)Restrictions on Use +You may not use, copy, modify, distribute, or create derivative works from the software without the prior written consent of the Author. -## 3. **Request for Authorization** -Any third party wishing to use, modify, copy, or distribute the software must submit a **request for authorization** to the Author. The request should be sent to Federico Elia. +3)Request for Authorization +Any third party wishing to use, modify, copy, or distribute the software must submit a request for authorization to the Author. The request should be sent to Federico Elia. -## 4. **Conditions of Authorization** +4)Conditions of Authorization The Author reserves the right to grant or deny authorization at their discretion. Any granted authorization will be subject to the terms and conditions set forth by the Author. -## 5. **Prohibition of Unauthorized Use** -Any unauthorized use of the software will be considered a **violation of copyright** and may be subject to legal action under applicable laws. +5)Prohibition of Unauthorized Use +Any unauthorized use of the software will be considered a violation of copyright and may be subject to legal action under applicable laws. -## 6. **Warranties and Liability** +6)Warranties and Liability The software is provided "as is," without any warranties of any kind, express or implied. The Author shall not be liable for any damages arising from the use or inability to use the software. -## 7. **Governing Law** +7)Governing Law This agreement shall be governed by the laws of Italy, without regard to its conflict of law provisions. From 3fec2aaacda73d9a334a690cab6aab2f6aad3811 Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:18:37 +0200 Subject: [PATCH 06/10] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 0e39673ec..c2840ab47 100644 --- a/LICENSE +++ b/LICENSE @@ -7,7 +7,7 @@ The software, titled Auto Jobs Applier AIHawk, is the exclusive property of Fede You may not use, copy, modify, distribute, or create derivative works from the software without the prior written consent of the Author. 3)Request for Authorization -Any third party wishing to use, modify, copy, or distribute the software must submit a request for authorization to the Author. The request should be sent to Federico Elia. +Any third party wishing to use, modify, copy, or distribute the software must submit a request for authorization to the Author. The request should be sent to federico.elia.majo@gmail.com 4)Conditions of Authorization The Author reserves the right to grant or deny authorization at their discretion. Any granted authorization will be subject to the terms and conditions set forth by the Author. From 4f1b91cb7960dc5a56b4a7ce5529177b1c8f1a64 Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sun, 13 Oct 2024 09:08:59 +0200 Subject: [PATCH 07/10] Update LICENSE --- LICENSE | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index c2840ab47..6e78d6850 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,25 @@ Proprietary License for Auto Jobs Applier AIHawk -1)Ownership -The software, titled Auto Jobs Applier AIHawk, is the exclusive property of Federico Elia (hereinafter referred to as "Author"). All rights, titles, and interests in this software are reserved to the Author. +1. Freedom to Use and Modify +The software may be freely used and modified by anyone without the need for authorization, provided that the source code remains accessible and open to the public. -2)Restrictions on Use -You may not use, copy, modify, distribute, or create derivative works from the software without the prior written consent of the Author. +2. Freedom of Distribution +Distribution of the software, whether in its original or modified form, is permitted without the need for authorization. However, any distribution must comply with the terms of this license, ensuring that the source code remains open source. -3)Request for Authorization -Any third party wishing to use, modify, copy, or distribute the software must submit a request for authorization to the Author. The request should be sent to federico.elia.majo@gmail.com +3. Authorization for Release of Source Code +Any derivative work or modification of the software may be released as open source without the need for authorization. However, it is not permitted to close the code or convert it into proprietary software without prior written authorization from the original author. This means that while users can publish their modifications as open source, they cannot restrict access to the code or claim ownership of the original software. -4)Conditions of Authorization -The Author reserves the right to grant or deny authorization at their discretion. Any granted authorization will be subject to the terms and conditions set forth by the Author. +4. Prohibition of Resale without Authorization +The software may not be sold without the explicit authorization of the original author. Distributions must be free or released under the same open-source terms. Any attempt to monetize the software or its modifications requires written consent from the author. -5)Prohibition of Unauthorized Use -Any unauthorized use of the software will be considered a violation of copyright and may be subject to legal action under applicable laws. +5. Non-Commercial Use +The software may only be used for non-commercial purposes unless explicit permission is granted by the author for commercial use. This includes use in sold products or services, which requires a specific agreement with the author. -6)Warranties and Liability -The software is provided "as is," without any warranties of any kind, express or implied. The Author shall not be liable for any damages arising from the use or inability to use the software. +6. Copyright +Copyright remains with the original author. Any use not in accordance with the terms of this license will be considered a copyright infringement. -7)Governing Law +7. Disclaimer of Warranty +This software is provided “as is,” without any warranties of any kind, express or implied. The author shall not be liable for any damages arising from the use of the software. + +8. Governing Law This agreement shall be governed by the laws of Italy, without regard to its conflict of law provisions. From b84f2ebbf4cca1e671a5a8c0e28a0dc8aeb4ed9d Mon Sep 17 00:00:00 2001 From: Federico <85809106+feder-cr@users.noreply.github.com> Date: Sun, 13 Oct 2024 09:15:26 +0200 Subject: [PATCH 08/10] Update LICENSE --- LICENSE | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/LICENSE b/LICENSE index 6e78d6850..4687cced0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,25 +1,16 @@ Proprietary License for Auto Jobs Applier AIHawk -1. Freedom to Use and Modify -The software may be freely used and modified by anyone without the need for authorization, provided that the source code remains accessible and open to the public. +1. Freedom to Use, Modify, and Distribute +The software may be freely used, modified, and distributed by anyone, provided that the source code remains accessible and open to the public. Any derivative work or modification may be released as open source but cannot be converted into proprietary software without prior written authorization from the original author. -2. Freedom of Distribution -Distribution of the software, whether in its original or modified form, is permitted without the need for authorization. However, any distribution must comply with the terms of this license, ensuring that the source code remains open source. +2. Prohibition of Resale and Non-Commercial Use +The software may not be sold without explicit authorization from the original author. It is intended for non-commercial use unless specific permission for commercial use is granted. -3. Authorization for Release of Source Code -Any derivative work or modification of the software may be released as open source without the need for authorization. However, it is not permitted to close the code or convert it into proprietary software without prior written authorization from the original author. This means that while users can publish their modifications as open source, they cannot restrict access to the code or claim ownership of the original software. +3. Copyright +Copyright remains with the original author. Any unauthorized use will be considered a copyright infringement. -4. Prohibition of Resale without Authorization -The software may not be sold without the explicit authorization of the original author. Distributions must be free or released under the same open-source terms. Any attempt to monetize the software or its modifications requires written consent from the author. +4. Disclaimer of Warranty +This software is provided “as is,” without warranties of any kind. The author shall not be liable for any damages arising from its use. -5. Non-Commercial Use -The software may only be used for non-commercial purposes unless explicit permission is granted by the author for commercial use. This includes use in sold products or services, which requires a specific agreement with the author. - -6. Copyright -Copyright remains with the original author. Any use not in accordance with the terms of this license will be considered a copyright infringement. - -7. Disclaimer of Warranty -This software is provided “as is,” without any warranties of any kind, express or implied. The author shall not be liable for any damages arising from the use of the software. - -8. Governing Law -This agreement shall be governed by the laws of Italy, without regard to its conflict of law provisions. +5. Governing Law +This agreement shall be governed by the laws of Italy. From ff96d0fc12be10d5bbf297ba78c11b48070cc892 Mon Sep 17 00:00:00 2001 From: Dnaynu Date: Sun, 13 Oct 2024 23:22:07 +0530 Subject: [PATCH 09/10] Docs: Typo Fix Corrected "succesfull" to "successful" in [README.md]. This pull request addresses a minor typo found in repository. The typo has been corrected to improve clarity and maintain the quality of the documentation. This change is purely cosmetic and does not affect functionality. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a552ee83..027b06ea1 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ Auto_Jobs_Applier_AIHawk steps in as a game-changing solution to these challenge ## Installation -**Confirmed succesfull runs on the following:** +**Confirmed successful runs on the following:** - Operating Systems: - Windows 10 - Ubuntu 22 From 41855ab504999b8a46351111c5875e0e97751153 Mon Sep 17 00:00:00 2001 From: manhphim Date: Mon, 14 Oct 2024 14:32:05 +0200 Subject: [PATCH 10/10] fix: issue #528 --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 1399f13de..1f86f0376 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager from selenium.common.exceptions import WebDriverException -from lib_resume_builder_AIHawk import Resume, FacadeManager, ResumeGenerator +from lib_resume_builder_AIHawk import Resume, FacadeManager, ResumeGenerator, StyleManager from src.utils import chrome_browser_options from src.llm.llm_manager import GPTAnswerer from src.aihawk_authenticator import AIHawkAuthenticator @@ -158,7 +158,7 @@ def init_browser() -> webdriver.Chrome: def create_and_run_bot(parameters, llm_api_key): try: - style_manager = FacadeManager.StyleManager() + style_manager = StyleManager() resume_generator = ResumeGenerator() with open(parameters['uploads']['plainTextResume'], "r", encoding='utf-8') as file: plain_text_resume = file.read()