@@ -149,34 +149,29 @@ def __get_headers(self):
149149 }
150150
151151 def validate_scopes (self ) -> dict [str , bool | str ]:
152- valid_tlds = [".com" , ".eu" , ".com.cn" , ".in" , ".com.au" , ".jp" ]
153- valid_tld_scope = "TLD not in [.com | .eu | .com.cn | .in | .com.au | .jp]"
154- authentication_scope = "Validate TLD first"
155- if self .authentication_config .zohoAccountTLD in valid_tlds :
156- valid_tld_scope = True
157- response = requests .get (
158- f'{ self .__get_url (paths = ["monitors" ])} ' , headers = self .__get_headers ()
152+ response = requests .get (
153+ f'{ self .__get_url (paths = ["monitors" ])} ' , headers = self .__get_headers ()
154+ )
155+ if response .status_code == 401 :
156+ authentication_scope = response .json ()
157+ self .logger .error (
158+ "Failed to authenticate user" ,
159+ extra = {"response" : authentication_scope },
160+ )
161+ elif response .status_code == 200 :
162+ authentication_scope = True
163+ self .logger .info ("Authenticated user successfully" )
164+ else :
165+ authentication_scope = (
166+ f"Error while authenticating user, { response .status_code } "
167+ )
168+ self .logger .error (
169+ "Error while authenticating user" ,
170+ extra = {"status_code" : response .status_code },
159171 )
160- if response .status_code == 401 :
161- authentication_scope = response .json ()
162- self .logger .error (
163- "Failed to authenticate user" ,
164- extra = {"response" : authentication_scope },
165- )
166- elif response .status_code == 200 :
167- authentication_scope = True
168- self .logger .info ("Authenticated user successfully" )
169- else :
170- authentication_scope = (
171- f"Error while authenticating user, { response .status_code } "
172- )
173- self .logger .error (
174- "Error while authenticating user" ,
175- extra = {"status_code" : response .status_code },
176- )
177172 return {
178173 "authenticated" : authentication_scope ,
179- "valid_tld" : valid_tld_scope ,
174+ "valid_tld" : True
180175 }
181176
182177 def setup_webhook (
0 commit comments