def testVerifyLowCredit(): client = quickemailverification.Client(os.getenv('apikey')) qevClient = client.quickemailverification() response = qevClient.sandbox('*****@*****.**') assert 402 == response.code
def post(self): parser = reqparse.RequestParser() parser.add_argument('First_name', location='json', required=True) parser.add_argument('last_name', location='json', required=True) parser.add_argument('email', location='json', required=True) parser.add_argument('phone', location='json', required=True) parser.add_argument('bod', location='json') parser.add_argument('address', location='json') parser.add_argument('gender', location='json', choices=['male', 'female']) parser.add_argument('company', location='json') # parser.add_argument('user_id', type=int location='json') args = parser.parse_args() claims = get_jwt_claims() client = quickemailverification.Client('cf42a86c0859259680f2fa74a3f4f3c2bbf1eb52511f9273d672c4bca43c') # Replace API_KEY with your API Key checking = client.quickemailverification() response = checking.verify(args['email']) # Email address which need to be verified validation = response.body['result'] customer = Customer(args['First_name'], args['last_name'], args['email'], args['phone'], args['bod'], args['address'], args['gender'], args['company'], claims['id'], validation) db.session.add(customer) db.session.commit() app.logger.debug('DEBUG: %s', customer) return marshal(customer, Customer.response_fields), 200
def testVerifyInvalidDomain(): client = quickemailverification.Client(os.getenv('apikey')) qevClient = client.quickemailverification() response = qevClient.sandbox('*****@*****.**') assert 200 == response.code assert 'invalid' == response.body['result'] assert 'invalid_domain' == response.body['reason'] assert 'false' == response.body['disposable'] assert 'false' == response.body['accept_all'] assert 'false' == response.body['role'] assert 'false' == response.body['free'] assert '*****@*****.**' == response.body['email'] assert 'invalid-domain' == response.body['user'] assert 'example.com' == response.body['domain'] assert '' == response.body['mx_record'] assert '' == response.body['mx_domain'] assert 'false' == response.body['safe_to_send'] assert '' == response.body['did_you_mean'] assert 'true' == response.body['success']
def testVerifyTemporarilyBlocked(): client = quickemailverification.Client(os.getenv('apikey')) qevClient = client.quickemailverification() response = qevClient.sandbox('*****@*****.**') assert 200 == response.code assert 'unknown' == response.body['result'] assert 'temporarily_blocked' == response.body['reason'] assert 'false' == response.body['disposable'] assert 'false' == response.body['accept_all'] assert 'false' == response.body['role'] assert 'false' == response.body['free'] assert '*****@*****.**' == response.body['email'] assert 'temporarily-blocked' == response.body['user'] assert 'example.com' == response.body['domain'] assert None == response.body['mx_record'] assert '' == response.body['mx_domain'] assert 'false' == response.body['safe_to_send'] assert '' == response.body['did_you_mean'] assert 'true' == response.body['success']
def register(): if request.method == "POST": ##to get the registration data fname = request.form.get("firstname") lname = request.form.get("lastname") address = request.form.get("address") email = request.form.get("email") password = request.form.get("password") ##to avoid duplicate emails registered cursor = mysql.get_db().cursor() cursor.execute('SELECT email FROM information where email=%s', email) checkIfemailExists = cursor.fetchall() if checkIfemailExists: return render_template( "registration.html", msg= "Sorry, the email is already taken! Please use a different email" ) ##to verify the email client = quickemailverification.Client(QUICK_MAIL_VERIFICATION_API_KEY) quickemailverification = client.quickemailverification() response = quickemailverification.verify(email) for i in response: if i['result'] == 'valid': inputData = (fname, lname, address, email, password) sql_insert_query = """INSERT INTO information(firstName, lastName, address, email,password) VALUES (%s, %s,%s, %s,%s) """ cursor.execute(sql_insert_query, inputData) mysql.get_db().commit() return redirect("home.html", code=302) else: return render_template( "registration.html", msg= "Sorry, this is a invalid email, Please try with a valid mail" ) if request.method == "GET": return render_template("registration.html")
from pymongo import MongoClient import pprint import quickemailverification client = MongoClient('mongodb://localhost:27017/') db = client['dbname'] cm = db['collectionname'] #TODO:- create an array of tokens and fetch the array index to validate multiple records token = 'API TOKEN' count = 0 verified_col = {"$set": {"isvalid": "true", "verified": "true"}} unverified_col = {"$set": {"isvalid": "false", "verified": "false"}} client = quickemailverification.Client(token) quickemailverification = client.quickemailverification() for c in cm.find( {'$or': [{ 'isvalid': { '$exists': False } }, { 'isvalid': 'false' }]}, { 'email': 1, '_id': 0 }): if (c['email'] != ''): #print(c['email']) ## call wrapper api to validate the email, if email is verified then do the flag changes, add/update flag for c['id'] response = quickemailverification.verify(c['email']) if (response.body['result'] != 'invalid'): # print(c['email']+' is '+response.body['result']) # print('----------------------------------------')
# Each time this function is called, the result # corresponding to that email would be printed on a new row. max_filled_row = sheet.max_row + 1 for label in response: data = response[label] # Using columns dictionary, determine the column # number in which the data should be displayed. column = columns[label] sheet[f"{column}{max_filled_row}"].font = data_font sheet[f"{column}{max_filled_row}"] = data wb.save('result.xlsx') if __name__ == "__main__": # Start a connection to QuickEmailVerification client = quickemailverification.Client(config.api_key) quickemailverification = client.quickemailverification() # Create an Excel Workbook. wb = openpyxl.Workbook() # Read the emails from the txt file and verify it. with open(r"email_list.txt") as f: emails = f.read().split("\n") for email in emails: response = quickemailverification.verify(email) if response.body['success'] == 'false': print("API Key is invalid. Follow the instructions ", end="") print("in README.md to get an API key.") break else: