Skip to content

Commit 81ceb97

Browse files
author
Hritwik
committed
fix wait time
1 parent ea2faa5 commit 81ceb97

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Diff for: petition.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from faker import Faker
88
from selenium import webdriver
99

10-
1110
# def retrieveNames(url, file_name):
1211
# user_agent = {
1312
# 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0'
@@ -32,8 +31,12 @@
3231
# retrieveNames(last_name_url, 'last_name')
3332
# retrieveNames(first_name_url, 'first_name')
3433

34+
wait_time = 3
35+
3536

3637
def sign(browser):
38+
global wait_time
39+
3740
fname = Faker().first_name()
3841
lname = Faker().last_name()
3942
randemail = fname + lname + str(random.randint(0, 50000)) + '@gmail.com'
@@ -72,17 +75,20 @@ def sign(browser):
7275

7376
publiccheck.click()
7477
emailbox.submit()
75-
time.sleep(3)
78+
time.sleep(wait_time)
7679

7780
if 'Share petition' not in browser.title:
81+
# print(browser.title)
7882
browser.delete_all_cookies()
79-
browser.get("https://www.giybf.com")
80-
time.sleep(30)
83+
wait_time += 1
84+
print("New Wait time:", wait_time)
85+
86+
time.sleep(10)
8187

8288
browser.delete_all_cookies()
8389

8490

85-
def start(test=0, pnum=0):
91+
def start(test=0):
8692
print("""
8793
____ _ ____ _
8894
/ ___|(_) __ _ _ __ | __ ) ___ | |_
@@ -106,11 +112,14 @@ def start(test=0, pnum=0):
106112
loc = './geckodriver_L64'
107113
else:
108114
loc = './geckodriver_L32'
109-
if os_name == "Windows":
115+
elif os_name == "Windows":
110116
if os_arch == "64bit":
111117
loc = './geckodriver_W64'
112118
else:
113119
loc = './geckodriver_W32'
120+
else:
121+
print("OS Not Supported...")
122+
exit(0)
114123

115124
# these are the workarounds for not getting flagged as bot
116125
# UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"

0 commit comments

Comments
 (0)