-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a571745
Showing
22 changed files
with
1,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "Build" | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 tox | ||
pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 src tests --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 src tests --count --exit-zero --max-line-length=127 --statistics | ||
- name: Test with tox | ||
env: | ||
API_KEY: ${{ secrets.WHOISXMLAPI_API_KEY }} | ||
BULK_WHOIS_REQUEST: ${{ secrets.WHOISXMLAPI_BULK_WHOIS_REQUEST }} | ||
run: | | ||
tox -e py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
build | ||
dist | ||
/**/*.egg-info | ||
/**/__pycache__ | ||
venv | ||
.env | ||
*.sh | ||
.tox | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
Authors | ||
======= | ||
|
||
* WHOIS API, Inc - `whoisxmlapi.com <https://whoisxmlapi.com>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
Changelog | ||
========= | ||
|
||
1.0.0 (2022-01-15) | ||
------------------ | ||
|
||
* First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2022 WHOIS API, Inc | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
graft src | ||
graft tests | ||
|
||
include AUTHORS.rst | ||
include CHANGELOG.rst | ||
include LICENSE | ||
include README.rst | ||
|
||
global-exclude *.py[cod] __pycache__ *.so *.dylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
.. image:: https://img.shields.io/badge/License-MIT-green.svg | ||
:alt: bulk-whois-api-py license | ||
:target: https://opensource.org/licenses/MIT | ||
|
||
.. image:: https://img.shields.io/pypi/v/bulk-whois-api.svg | ||
:alt: bulk-whois-api-py release | ||
:target: https://pypi.org/project/bulk-whois-api | ||
|
||
.. image:: https://github.com/whois-api-llc/bulk-whois-api-py/workflows/Build/badge.svg | ||
:alt: bulk-whois-api-py build | ||
:target: https://github.com/whois-api-llc/bulk-whois-api-py/actions | ||
|
||
======== | ||
Overview | ||
======== | ||
|
||
The client library for | ||
`Bulk Whois API <https://whois.whoisxmlapi.com/bulk-api>`_ | ||
in Python language. | ||
|
||
The minimum Python version is 3.6. | ||
|
||
Installation | ||
============ | ||
|
||
.. code-block:: shell | ||
pip install bulk-whois-api | ||
Examples | ||
======== | ||
|
||
Full API documentation available `here <https://whois.whoisxmlapi.com/bulk-api/documentation/making-requests>`_ | ||
|
||
Create a new client | ||
------------------- | ||
|
||
.. code-block:: python | ||
from bulkwhoisapi import * | ||
client = Client('Your API key') | ||
Create bulk request | ||
------------------- | ||
|
||
.. code-block:: python | ||
domains = [ | ||
'example.com', | ||
'example.org' | ||
] | ||
result = client.create_request(domains=domains) | ||
# Used for further requests | ||
request_id = result.request_id | ||
Get Whois records | ||
------------------- | ||
|
||
.. code-block:: python | ||
result = client.get_records( | ||
request_id=request_id, | ||
max_records=len(domains) | ||
) | ||
# Finished once result.records_left == 0 | ||
print(result) | ||
List your requests | ||
------------------- | ||
|
||
.. code-block:: python | ||
result = client.get_requests() | ||
Download CSV result | ||
------------------- | ||
|
||
.. code-block:: python | ||
client.download(filename='records.csv', request_id=request_id) | ||
Extras | ||
------------------- | ||
|
||
.. code-block:: python | ||
# Paginate over processed records and get results in XML | ||
result = client.get_records_raw( | ||
request_id=request_id, | ||
max_records=1, | ||
start_index=2, | ||
output_format=Client.XML_FORMAT | ||
) | ||
Response model overview | ||
----------------------- | ||
|
||
.. code-block:: python | ||
ResponseCreate: | ||
- request_id: str | ||
- invalid_domains: [str] | ||
ResponseRecords: | ||
- no_data_available: bool | ||
- request_id: str | ||
- total_records: int | ||
- records_left: int | ||
- records_processed: int | ||
- domain_list: [str] | ||
- whois_records: [BulkWhoisRecord] | ||
ResponseRequests: | ||
- user_requests: [BulkRequest] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
requests==2.27.1 | ||
whois-api==1.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env python | ||
# -*- encoding: utf-8 -*- | ||
|
||
import io | ||
import re | ||
from glob import glob | ||
from os.path import basename | ||
from os.path import dirname | ||
from os.path import join | ||
from os.path import splitext | ||
|
||
from setuptools import find_packages | ||
from setuptools import setup | ||
|
||
|
||
def read(*names, **kwargs): | ||
return io.open( | ||
join(dirname(__file__), *names), | ||
encoding=kwargs.get('encoding', 'utf8') | ||
).read() | ||
|
||
|
||
version_content = {} | ||
exec(read('src/bulkwhoisapi/version.py'), version_content) | ||
|
||
setup( | ||
name='bulk-whois-api', | ||
version=version_content['VERSION'], | ||
python_requires='>=3.6', | ||
license='MIT', | ||
description='Python client library for Bulk Whois API.', | ||
long_description='%s\n%s' % ( | ||
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), | ||
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst')) | ||
), | ||
author='WHOIS API, Inc', | ||
author_email='[email protected]', | ||
url='https://github.com/whois-api-llc/bulk-whois-api-py', | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], | ||
include_package_data=True, | ||
zip_safe=False, | ||
classifiers=[ | ||
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: Unix', | ||
'Operating System :: POSIX', | ||
'Operating System :: Microsoft :: Windows', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Topic :: Utilities', | ||
], | ||
keywords=[ | ||
'bulk', | ||
'whois', | ||
'api', | ||
'whoisxmlapi', | ||
], | ||
install_requires=[ | ||
'requests', | ||
'whois-api' | ||
], | ||
extras_require={ | ||
'dev': [ | ||
'tox', | ||
'flake8', | ||
] | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
__all__ = ['ApiAuthError', 'ApiRequester', 'Audit', 'BadRequestError', | ||
'BulkRequest', 'BulkWhoisApiError', 'BulkWhoisRecord', 'Client', | ||
'Contact', 'EmptyApiKeyError', 'ErrorMessage', 'FileError', | ||
'HttpApiError', 'NameServers', 'ParameterError', 'Registrant', | ||
'RegistryData', 'ResponseCreate', 'ResponseError', | ||
'ResponseRecords', 'ResponseRequests', | ||
'UnparsableApiResponseError', 'WhoisRecord'] | ||
|
||
from .client import Client | ||
|
||
from .models.response import BulkRequest, BulkWhoisRecord, ErrorMessage, \ | ||
RegistryData, ResponseCreate, ResponseRecords, ResponseRequests, \ | ||
WhoisRecord | ||
|
||
from .net.http import ApiRequester | ||
|
||
from .exceptions.error import ApiAuthError, BadRequestError, \ | ||
BulkWhoisApiError, EmptyApiKeyError, FileError, HttpApiError, \ | ||
ParameterError, ResponseError, UnparsableApiResponseError | ||
|
||
from whoisapi import Registrant, Contact, Audit, NameServers |
Oops, something went wrong.