88
99# Configure Chrome options
1010chrome_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 })
1213
1314# Load environmental variables from .env file
1415load_dotenv (dotenv_path = Path ("." , ".env" ))
1516
1617# Read credentials from environmental variables
18+
19+
1720def read_creds ():
1821 return {"username" : os .getenv ("username" ), "password" : os .getenv ("password" )}
1922
2023# Function for accepting requests
24+
25+
2126def accept_requests (browser ):
2227 browser .get ("https://www.facebook.com/friends" )
2328 element_id = browser .find_element_by_css_selector ("input#email" )
@@ -27,7 +32,8 @@ def accept_requests(browser):
2732 element_id .submit ()
2833
2934 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']" )
3137 if not confirm_btns :
3238 break
3339
@@ -44,6 +50,7 @@ def accept_requests(browser):
4450 except :
4551 pass
4652
53+
4754def main ():
4855 # Initialize Chrome browser with options
4956 browser = webdriver .Chrome (options = chrome_options )
@@ -56,5 +63,6 @@ def main():
5663 print ("All Request Accepted" )
5764 browser .quit ()
5865
66+
5967if _name_ == "_main_" :
60- main ()
68+ main ()
0 commit comments