forked from wodsuz/EasyApplyJobsBot
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
allConfigsRunner.py
25 lines (20 loc) · 1.01 KB
/
allConfigsRunner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys, time, random, constants, subprocess
from pathlib import Path
def main(base_path):
configs_path = Path(f"{base_path}/configs")
config_files = sorted(configs_path.glob('*_config.py'))
for config_file in config_files:
print(f"Starting LinkedIn application with configuration: {config_file.name}")
# Copy the current config file to config.py
subprocess.run(["cp", "-f", str(config_file), f"{base_path}/config.py"], check=True)
# Run the LinkedIn Easy Apply bot
subprocess.run(["python", f"{base_path}/runner.py"], check=True)
# Wait for a specified number of seconds or implement a random wait time
sleep_time = random.uniform(constants.botSleepInBetweenSearchesBottom, constants.botSleepInBetweenSearchesTop)
print(f"Sleeping for {sleep_time} seconds.")
time.sleep(sleep_time)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python allConfigsRunner.py <base_path>")
sys.exit(1)
main(sys.argv[1])