From c7b20fd68dd3ee65635ccd6c1fd90df5dcf56b69 Mon Sep 17 00:00:00 2001 From: Eduardo Hernandez Soto Date: Fri, 10 Dec 2021 17:49:28 -0500 Subject: [PATCH 1/4] add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file From 69fc6b73ea1d341141257b0b03e9458313227182 Mon Sep 17 00:00:00 2001 From: Eduardo Hernandez Soto Date: Fri, 10 Dec 2021 18:18:24 -0500 Subject: [PATCH 2/4] add instructions for virtual-env --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e8ff0fa..44a9b36 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,15 @@ sc.js is a the base of the ios shortcut [COMING SOON] # Setup -On mac/pc: +## Using virtualenv +> Recommend using pipx: https://github.com/pypa/pipx + +- Install virtual-env + - `pipx install virtualenv` +- Install requirements + - `pip install -r requirements.txt` + +## On mac/pc: `pip install -r requirements.txt` @@ -24,7 +32,7 @@ It needs to be found in your `PATH` variable. `python req.py` to run. It will loop until you kill the job. `ctrl + c` in your terminal to give the pro lifes a break (optional). -mac: +## mac: You might also get a trust issue with the downloaded driver being unverified. To fix that, run From 1e86baebf4c6e8daa67dddace2261a7cc8d19295 Mon Sep 17 00:00:00 2001 From: Eduardo Hernandez Soto Date: Fri, 10 Dec 2021 18:21:41 -0500 Subject: [PATCH 3/4] ignore downloaded chrome driver --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 723ef36..879453e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +chromedriver \ No newline at end of file From 9a64bd5e7c86c05c7ab0b13907aafd8fc94719e3 Mon Sep 17 00:00:00 2001 From: Eduardo Hernandez Soto Date: Fri, 10 Dec 2021 18:30:48 -0500 Subject: [PATCH 4/4] do it twice at a time --- req.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/req.py b/req.py index b6f8307..0ba876e 100644 --- a/req.py +++ b/req.py @@ -5,7 +5,10 @@ import time import os import functools +import threading from faker import Faker + + fake = Faker() chromedriver_location = "./chromedriver" print = functools.partial(print, flush=True) @@ -51,6 +54,7 @@ 'Memphis': ['38116', '38118', '38122', '38127', '38134', '38103'], } + def start_driver(rand_num): driver = webdriver.Chrome(chromedriver_location) driver.get(urls[rand_num]) @@ -66,6 +70,7 @@ def start_driver(rand_num): '//*[@id="page_content"]/div[2]/div/div/div[2]/div/div/div[2]/a').click() return driver + def generate_account(driver, rand_num): # make fake account info and fill @@ -170,6 +175,7 @@ def fill_out_application_and_submit(driver, rand_num): driver.find_element_by_xpath('//*[@id="261:_submitBtn"]').click() print(f"successfully submitted application") + def main(): rand_num = random.randint(0, 3) i = 1 @@ -198,6 +204,15 @@ def main(): driver.close() time.sleep(5) + if __name__ == '__main__': - main() - sys.exit() \ No newline at end of file + t1 = threading.Thread(target=main) + t2 = threading.Thread(target=main) + + t1.start() + t2.start() + + t1.join() + t2.join() + + sys.exit()