@@ -27,7 +27,9 @@ class MetaAI:
2727 and receiving messages from the Meta AI Chat API.
2828 """
2929
30- def __init__ (self , fb_email : str = None , fb_password : str = None , proxy : dict = None ):
30+ def __init__ (
31+ self , fb_email : str = None , fb_password : str = None , proxy : dict = None
32+ ):
3133 self .session = requests .Session ()
3234 self .session .headers .update (
3335 {
@@ -40,15 +42,17 @@ def __init__(self, fb_email: str = None, fb_password: str = None, proxy: dict =
4042 self .fb_password = fb_password
4143 self .proxy = proxy
4244 if self .proxy and not self .check_proxy ():
43- raise ConnectionError ("Unable to connect to proxy. Please check your proxy settings." )
45+ raise ConnectionError (
46+ "Unable to connect to proxy. Please check your proxy settings."
47+ )
4448
4549 self .is_authed = fb_password is not None and fb_email is not None
4650 self .cookies = self .get_cookies ()
4751
48- def check_proxy (self , test_url : str = "https://api.ipify.org/?format=json" ) -> bool :
52+ def check_proxy (self , test_url : str = "https://api.ipify.org/?format=json" ) -> bool :
4953 """
5054 Checks the proxy connection by making a request to a test URL.
51-
55+
5256 Args:
5357 test_url (str): A test site from which we check that the proxy is installed correctly.
5458
@@ -58,7 +62,6 @@ def check_proxy(self, test_url: str="https://api.ipify.org/?format=json") -> boo
5862 try :
5963 response = self .session .get (test_url , proxies = self .proxy , timeout = 10 )
6064 if response .status_code == 200 :
61- print (response .json ())
6265 self .session .proxies = self .proxy
6366 return True
6467 return False
0 commit comments