-
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 d393785
Showing
24 changed files
with
1,286 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,39 @@ | ||
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 }} | ||
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 (2021-09-14) | ||
------------------ | ||
|
||
* 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) 2021 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,96 @@ | ||
.. image:: https://img.shields.io/badge/License-MIT-green.svg | ||
:alt: registrant-alert-py license | ||
:target: https://opensource.org/licenses/MIT | ||
|
||
.. image:: https://img.shields.io/pypi/v/registrant-alert.svg | ||
:alt: registrant-alert-py release | ||
:target: https://pypi.org/project/registrant-alert | ||
|
||
.. image:: https://github.com/whois-api-llc/registrant-alert-py/workflows/Build/badge.svg | ||
:alt: registrant-alert-py build | ||
:target: https://github.com/whois-api-llc/registrant-alert-py/actions | ||
|
||
======== | ||
Overview | ||
======== | ||
|
||
The client library for | ||
`Registrant Alert API <https://registrant-alert.whoisxmlapi.com/>`_ | ||
in Python language. | ||
|
||
The minimum Python version is 3.6. | ||
|
||
Installation | ||
============ | ||
|
||
.. code-block:: shell | ||
pip install registrant-alert | ||
Examples | ||
======== | ||
|
||
Full API documentation available `here <https://registrant-alert.whoisxmlapi.com/api/documentation/making-requests>`_ | ||
|
||
Create a new client | ||
------------------- | ||
|
||
.. code-block:: python | ||
from registrantalert import * | ||
client = Client('Your API key') | ||
Make basic requests | ||
------------------- | ||
|
||
.. code-block:: python | ||
# Get the number of domains. | ||
terms = { | ||
'include': ['blog'] | ||
} | ||
result = client.preview(basic_terms=terms) | ||
print(result.domains_count) | ||
# Get raw API response | ||
raw_result = client.raw_data( | ||
basic_terms=terms, | ||
response_format=Client.XML_FORMAT, | ||
mode=Client.PREVIEW_MODE) | ||
# Get a list of registered/dropped domains (up to 10,000) | ||
result = client.purchase( | ||
basic_terms=terms | ||
) | ||
Advanced usage | ||
------------------- | ||
|
||
Extra request parameters | ||
|
||
.. code-block:: python | ||
advanced_terms = [{ | ||
'field': Fields.registrant_contact_organization, | ||
'term': 'Airbnb, Inc.', | ||
'exactMatch': True | ||
}] | ||
since_date = datetime.date(2021, 8, 12) | ||
result = client.purchase( | ||
advanced_terms=advanced_terms, | ||
since_date=since_date, | ||
punycode=False) | ||
Response model overview | ||
----------------------- | ||
|
||
.. code-block:: python | ||
Response: | ||
- domains_count: int | ||
- domains_list: [Domain] | ||
- domain_name: str | ||
- date: datetime.date | ||
- action: str | ||
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 @@ | ||
requests==2.25.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,77 @@ | ||
#!/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/registrantalert/version.py'), version_content) | ||
|
||
setup( | ||
name='registrant-alert', | ||
version=version_content['VERSION'], | ||
python_requires='>=3.6', | ||
license='MIT', | ||
description='Python client library for Registrant Alert 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='support@whoisxmlapi.com', | ||
url='https://github.com/whois-api-llc/registrant-alert-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=[ | ||
'registrant', | ||
'registrantalert', | ||
'alert', | ||
'api', | ||
'whois', | ||
'whoisxmlapi', | ||
], | ||
install_requires=[ | ||
'requests', | ||
], | ||
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,12 @@ | ||
__all__ = ['Client', 'ErrorMessage', 'RegistrantAlertApiError', 'ApiAuthError', | ||
'HttpApiError', 'EmptyApiKeyError', 'ParameterError', | ||
'ResponseError', 'BadRequestError', 'UnparsableApiResponseError', | ||
'ApiRequester', 'Domain', 'Response', 'Fields'] | ||
|
||
from .client import Client | ||
from .net.http import ApiRequester | ||
from .models.request import Fields | ||
from .models.response import ErrorMessage, Response, Domain | ||
from .exceptions.error import RegistrantAlertApiError, ParameterError, \ | ||
EmptyApiKeyError, ResponseError, UnparsableApiResponseError, \ | ||
ApiAuthError, BadRequestError, HttpApiError |
Oops, something went wrong.