Skip to content

Commit 7118574

Browse files
committed
Initial commit
0 parents  commit 7118574

23 files changed

Lines changed: 1757 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Build"
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: "Build"
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.7, 3.8, 3.9]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Cache pip
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.cache/pip
22+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
23+
restore-keys: |
24+
${{ runner.os }}-pip-
25+
${{ runner.os }}-
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install flake8 tox
30+
pip install -r requirements.txt
31+
- name: Lint with flake8
32+
run: |
33+
flake8 src tests --count --select=E9,F63,F7,F82 --show-source --statistics
34+
flake8 src tests --count --exit-zero --max-line-length=127 --statistics
35+
- name: Test with tox
36+
env:
37+
API_KEY: ${{ secrets.WHOISXMLAPI_API_KEY }}
38+
run: |
39+
tox -e py

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build
2+
dist
3+
/**/*.egg-info
4+
/**/__pycache__
5+
venv
6+
.env
7+
*.sh
8+
.tox
9+
.idea

AUTHORS.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
Authors
3+
=======
4+
5+
* WHOIS API, Inc - `whoisxmlapi.com <https://whoisxmlapi.com>`_

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Changelog
3+
=========
4+
5+
1.0.1 (2022-01-18)
6+
------------------
7+
8+
* First release

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2022 WHOIS API, Inc
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

MANIFEST.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
graft src
2+
graft tests
3+
4+
include AUTHORS.rst
5+
include CHANGELOG.rst
6+
include LICENSE
7+
include README.rst
8+
9+
global-exclude *.py[cod] __pycache__ *.so *.dylib

README.rst

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
.. image:: https://img.shields.io/badge/License-MIT-green.svg
2+
:alt: python-bulk-email-verifier license
3+
:target: https://opensource.org/licenses/MIT
4+
5+
.. image:: https://img.shields.io/pypi/v/bulk-email-verifier.svg
6+
:alt: python-bulk-email-verifier release
7+
:target: https://pypi.org/project/bulk-email-verifier
8+
9+
.. image:: https://github.com/whois-api-llc/python-bulk-email-verifier/workflows/Build/badge.svg
10+
:alt: python-bulk-email-verifier build
11+
:target: https://github.com/whois-api-llc/python-bulk-email-verifier/actions
12+
13+
========
14+
Overview
15+
========
16+
17+
The client library for
18+
`Bulk Email Verification API <https://emailverification.whoisxmlapi.com/bulk-api>`_
19+
in Python language.
20+
21+
The minimum Python version is 3.6.
22+
23+
Installation
24+
============
25+
26+
.. code-block:: shell
27+
28+
pip install bulk-email-verifier
29+
30+
Examples
31+
========
32+
33+
Full API documentation available `here <https://emailverification.whoisxmlapi.com/bulk-api/documentation/making-requests>`_
34+
35+
Create a new client
36+
-------------------
37+
38+
.. code-block:: python
39+
40+
from bulkemailverifier import *
41+
42+
client = Client('Your API key')
43+
44+
Create bulk request
45+
-------------------
46+
47+
.. code-block:: python
48+
49+
emails = [
50+
'example@example.com',
51+
'test@example.org',
52+
'test'
53+
]
54+
55+
request_id = client.create_request(emails=emails)
56+
57+
Get request status
58+
-------------------
59+
60+
.. code-block:: python
61+
62+
result = client.get_status(request_ids=[request_id])
63+
64+
# Finished once result.data[i].ready == True
65+
print(result)
66+
67+
Get email records
68+
-------------------
69+
70+
.. code-block:: python
71+
72+
completed = client.get_records(request_id=request_id)
73+
74+
# Invalid and failed emails
75+
failed = client.get_records(request_id=request_id, return_failed=True)
76+
77+
List your requests
78+
-------------------
79+
80+
.. code-block:: python
81+
82+
result = client.get_requests()
83+
84+
Download CSV result
85+
-------------------
86+
87+
.. code-block:: python
88+
89+
client.download(filename='emails.csv', request_id=request_id)
90+
91+
Extras
92+
-------------------
93+
94+
.. code-block:: python
95+
96+
# Paginate over request IDs in descending order and get results in XML
97+
result = client.get_requests_raw(
98+
only_ids=True,
99+
page=2,
100+
per_page=20,
101+
sort=Client.SORT_DESC,
102+
output_format=Client.XML_FORMAT
103+
)
104+
105+
Response model overview
106+
-----------------------
107+
108+
.. code-block:: python
109+
110+
ResponseRecords:
111+
- data: [Record]
112+
- email_address: str
113+
- format_check: bool
114+
- smtp_check: bool
115+
- dns_check: bool
116+
- free_check: bool
117+
- disposable_check: bool
118+
- catch_all_check: bool
119+
- result: str
120+
- error: str
121+
- mx_records: [str]
122+
123+
ResponseRequests:
124+
- current_page: int
125+
- from_requests: int
126+
- last_page: int
127+
- per_page: int
128+
- to_requests: int
129+
- total: int
130+
- data: [BulkRequest]
131+
- id: int
132+
- date_start: datetime.datetime
133+
- total_emails: int
134+
- invalid_emails: int
135+
- processed_emails: int
136+
- failed_emails: int
137+
- ready: bool
138+
139+
ResponseStatus:
140+
- data: [BulkRequest]
141+

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests==2.27.1

setup.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env python
2+
# -*- encoding: utf-8 -*-
3+
4+
import io
5+
import re
6+
from glob import glob
7+
from os.path import basename
8+
from os.path import dirname
9+
from os.path import join
10+
from os.path import splitext
11+
12+
from setuptools import find_packages
13+
from setuptools import setup
14+
15+
16+
def read(*names, **kwargs):
17+
return io.open(
18+
join(dirname(__file__), *names),
19+
encoding=kwargs.get('encoding', 'utf8')
20+
).read()
21+
22+
23+
version_content = {}
24+
exec(read('src/bulkemailverifier/version.py'), version_content)
25+
26+
setup(
27+
name='bulk-email-verifier',
28+
version=version_content['VERSION'],
29+
python_requires='>=3.6',
30+
license='MIT',
31+
description='Python client library for Bulk Email Verification API.',
32+
long_description='%s\n%s' % (
33+
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')),
34+
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
35+
),
36+
author='WHOIS API, Inc',
37+
author_email='support@whoisxmlapi.com',
38+
url='https://github.com/whois-api-llc/python-bulk-email-verifier',
39+
packages=find_packages('src'),
40+
package_dir={'': 'src'},
41+
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
42+
include_package_data=True,
43+
zip_safe=False,
44+
classifiers=[
45+
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
46+
'Development Status :: 5 - Production/Stable',
47+
'Intended Audience :: Developers',
48+
'License :: OSI Approved :: MIT License',
49+
'Operating System :: Unix',
50+
'Operating System :: POSIX',
51+
'Operating System :: Microsoft :: Windows',
52+
'Programming Language :: Python',
53+
'Programming Language :: Python :: 3',
54+
'Programming Language :: Python :: 3.6',
55+
'Programming Language :: Python :: 3.7',
56+
'Programming Language :: Python :: 3.8',
57+
'Programming Language :: Python :: 3.9',
58+
'Topic :: Utilities',
59+
],
60+
keywords=[
61+
'bulk',
62+
'email',
63+
'verification',
64+
'email verifier',
65+
'api',
66+
'email verification api',
67+
'whoisxmlapi',
68+
],
69+
install_requires=[
70+
'requests',
71+
],
72+
extras_require={
73+
'dev': [
74+
'tox',
75+
'flake8',
76+
]
77+
}
78+
)

src/bulkemailverifier/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
__all__ = ['ApiAuthError', 'ApiRequester', 'BadRequestError', 'BulkRequest',
2+
'BulkEmailVerificationApiError', 'Client', 'EmptyApiKeyError',
3+
'ErrorMessage', 'FileError', 'HttpApiError', 'ParameterError',
4+
'Record', 'ResponseError', 'ResponseRecords', 'ResponseRequests',
5+
'ResponseStatus', 'UnparsableApiResponseError']
6+
7+
from .client import Client
8+
9+
from .models.response import BulkRequest, Record, ErrorMessage, \
10+
ResponseRecords, ResponseRequests, ResponseStatus
11+
12+
from .net.http import ApiRequester
13+
14+
from .exceptions.error import ApiAuthError, BadRequestError, \
15+
BulkEmailVerificationApiError, EmptyApiKeyError, FileError, HttpApiError,\
16+
ParameterError, ResponseError, UnparsableApiResponseError

0 commit comments

Comments
 (0)