8
8
9
9
# Configure Chrome options
10
10
chrome_options = Options ()
11
- chrome_options .add_experimental_option ("prefs" , {"profile.default_content_setting_values.notifications" : 2 })
11
+ chrome_options .add_experimental_option (
12
+ "prefs" , {"profile.default_content_setting_values.notifications" : 2 })
12
13
13
14
# Load environmental variables from .env file
14
15
load_dotenv (dotenv_path = Path ("." , ".env" ))
15
16
16
17
# Read credentials from environmental variables
18
+
19
+
17
20
def read_creds ():
18
21
return {"username" : os .getenv ("username" ), "password" : os .getenv ("password" )}
19
22
20
23
# Function for accepting requests
24
+
25
+
21
26
def accept_requests (browser ):
22
27
browser .get ("https://www.facebook.com/friends" )
23
28
element_id = browser .find_element_by_css_selector ("input#email" )
@@ -27,7 +32,8 @@ def accept_requests(browser):
27
32
element_id .submit ()
28
33
29
34
while True :
30
- confirm_btns = browser .find_elements_by_css_selector ("div[aria-label='Confirm']" )
35
+ confirm_btns = browser .find_elements_by_css_selector (
36
+ "div[aria-label='Confirm']" )
31
37
if not confirm_btns :
32
38
break
33
39
@@ -44,6 +50,7 @@ def accept_requests(browser):
44
50
except :
45
51
pass
46
52
53
+
47
54
def main ():
48
55
# Initialize Chrome browser with options
49
56
browser = webdriver .Chrome (options = chrome_options )
@@ -56,5 +63,6 @@ def main():
56
63
print ("All Request Accepted" )
57
64
browser .quit ()
58
65
66
+
59
67
if _name_ == "_main_" :
60
- main ()
68
+ main ()
0 commit comments