Python Forum
How can I get Python Bulk Email Verification Script With API? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How can I get Python Bulk Email Verification Script With API? (/thread-33881.html)



How can I get Python Bulk Email Verification Script With API? - zainalee - Jun-06-2021

Hello Everyone,
I have an email verification API and I want to use it through Python.
I wanna make a Python script identical may be it should accept email list in the form of text or csv file, checks them through the API, then exports the results in each file accordingly; Valid, Invalid and Unknown.

How to do it? And is there an already template that I can obtain and just add my API key to it?

Thanks in Advance


RE: How can I get Python Bulk Email Verification Script With API? - snippsat - Jun-06-2021

Using Requests is the common way to talk to an API in Python.
Most API will get JSON back,so when use Requests will automatically decode return JSON to a Python dictionary.
Example.
>>> import requests
>>> 
>>> response = requests.get('https://api.github.com/users/defunkt')
>>> response.status_code
200
# Get json return data
>>> data = response.json()
>>> data['login']
'defunkt'
>>> data['bio']
'🍔'

# As it's now a dictionary can eg use get() method 
>>> data.get('name', 'No data from this requests')
'Chris Wanstrath'
>>> data.get('car', 'No data from this requests')
'No data from this requests'