88def is_valid_data (token , data ):
99 if not any ([key in list (data .keys ()) for key in ["url" , "email" , "phone" , "domain" , "creditCard" , "ip" , "wallet" , "userAgent" , "iban" ]]): raise BadRequestError ("You must provide at least one parameter." )
1010 try :
11- response = requests .post (f"{ get_base_url ()} /v1/private/secure/verify" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token })
11+ response = requests .post (f"{ get_base_url ()} /v1/private/secure/verify" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token })
1212 response .raise_for_status ()
1313 return response .json ()
1414 except requests .RequestException as e : raise APIError (str (e ))
1515
1616def is_valid_data_raw (token , data ):
1717 if not any ([key in list (data .keys ()) for key in ["url" , "email" , "phone" , "domain" , "creditCard" , "ip" , "wallet" , "userAgent" , "iban" ]]): raise BadRequestError ("You must provide at least one parameter." )
1818 try :
19- response = requests .post (f"{ get_base_url ()} /v1/private/secure/verify" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token })
19+ response = requests .post (f"{ get_base_url ()} /v1/private/secure/verify" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token })
2020 response .raise_for_status ()
2121 return response .json ()
2222 except requests .RequestException as e : raise APIError (str (e ))
@@ -54,7 +54,7 @@ def is_valid_email(token: Optional[str], email: str, rules: Optional[Dict[str, L
5454 resp = requests .post (
5555 f"{ get_base_url ()} /v1/private/secure/verify" ,
5656 json = {"email" : email , "plugins" : plugins },
57- headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token }
57+ headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token }
5858 )
5959 resp .raise_for_status ()
6060 data = resp .json ().get ("email" , {})
@@ -110,7 +110,7 @@ def is_valid_ip(token: Optional[str], ip: str, rules: Optional[Dict[str, List[st
110110 """
111111 if token is None : raise APIError ("Invalid private token." )
112112
113- if rules is None : rules = {"deny" : ["FRAUD" , "INVALID" , "TOR_NETWORK" ]}
113+ if rules is None : rules = {"deny" : ["FRAUD" , "INVALID" , "VPN" , " TOR_NETWORK" ]}
114114
115115 plugins = [
116116 "torNetwork" if "TOR_NETWORK" in rules ["deny" ] else None ,
@@ -122,7 +122,7 @@ def is_valid_ip(token: Optional[str], ip: str, rules: Optional[Dict[str, List[st
122122 resp = requests .post (
123123 f"{ get_base_url ()} /v1/private/secure/verify" ,
124124 json = {"ip" : ip , "plugins" : plugins },
125- headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token }
125+ headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token }
126126 )
127127 resp .raise_for_status ()
128128 data = resp .json ().get ("ip" , {})
@@ -138,6 +138,8 @@ def is_valid_ip(token: Optional[str], ip: str, rules: Optional[Dict[str, List[st
138138 "response" : data
139139 }
140140 if "FRAUD" in deny and data .get ("fraud" , False ): reasons .append ("FRAUD" )
141+ if "VPN" in deny and data .get ("vpn" , False ): reasons .append ("VPN" )
142+ if "PROXY" in deny and data .get ("proxy" , False ): reasons .append ("PROXY" )
141143 if "TOR_NETWORK" in deny and data .get ("plugins" , {}).get ("torNetwork" , False ): reasons .append ("TOR_NETWORK" )
142144 if "HIGH_RISK_SCORE" in deny and data .get ("plugins" , {}).get ("riskScore" , 0 ) >= 80 : reasons .append ("HIGH_RISK_SCORE" )
143145
@@ -186,7 +188,7 @@ def is_valid_phone(token: Optional[str], phone: str, rules: Optional[Dict[str, L
186188 resp = requests .post (
187189 f"{ get_base_url ()} /v1/private/secure/verify" ,
188190 json = {"phone" : phone , "plugins" : plugins },
189- headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token }
191+ headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token }
190192 )
191193 resp .raise_for_status ()
192194 data = resp .json ().get ("phone" , {})
@@ -225,7 +227,7 @@ def send_email(token, data):
225227 if not data .get ("subject" ): raise BadRequestError ("You must provide a subject for the email to be sent." )
226228 if not data .get ("html" ): raise BadRequestError ("You must provide HTML." )
227229 try :
228- response = requests .post (f"{ get_base_url ()} /v1/private/sender/sendEmail" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token })
230+ response = requests .post (f"{ get_base_url ()} /v1/private/sender/sendEmail" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token })
229231 response .raise_for_status ()
230232 return response .json ()
231233 except requests .RequestException as e : raise APIError (str (e ))
@@ -237,7 +239,7 @@ def get_random(token, data):
237239 if data .get ("min" ) < - 1000000000 or data .get ("min" ) > 1000000000 : raise BadRequestError ("'min' must be an integer in the interval [-1000000000, 1000000000]." )
238240 if data .get ("max" ) < - 1000000000 or data .get ("max" ) > 1000000000 : raise BadRequestError ("'max' must be an integer in the interval [-1000000000, 1000000000]." )
239241 try :
240- response = requests .post (f"{ get_base_url ()} /v1/private/srng" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.68 " , "Authorization" : token })
242+ response = requests .post (f"{ get_base_url ()} /v1/private/srng" , json = data , headers = {"User-Agent" : "DymoAPISDK/1.0.0" , "X-Dymo-SDK-Env" : "Python" , "X-Dymo-SDK-Version" : "0.0.69 " , "Authorization" : token })
241243 response .raise_for_status ()
242244 return response .json ()
243245 except requests .RequestException as e : raise APIError (str (e ))
@@ -255,7 +257,7 @@ def extract_with_textly(token: str, data: dict) -> dict:
255257 "Content-Type" : "application/json" ,
256258 "User-Agent" : "DymoAPISDK/1.0.0" ,
257259 "X-Dymo-SDK-Env" : "Python" ,
258- "X-Dymo-SDK-Version" : "0.0.68 " ,
260+ "X-Dymo-SDK-Version" : "0.0.69 " ,
259261 "Authorization" : token
260262 }
261263 )
0 commit comments