Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisxmlapi committed Sep 16, 2021
0 parents commit d393785
Show file tree
Hide file tree
Showing 24 changed files with 1,286 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build
dist
/**/*.egg-info
/**/__pycache__
venv
.env
*.sh
.tox
.idea
5 changes: 5 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Authors
=======

* WHOIS API, Inc - `whoisxmlapi.com <https://whoisxmlapi.com>`_
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Changelog
=========

1.0.0 (2021-09-14)
------------------

* First release
19 changes: 19 additions & 0 deletions LICENSE
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.
9 changes: 9 additions & 0 deletions MANIFEST.in
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
96 changes: 96 additions & 0 deletions README.rst
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.25.1
77 changes: 77 additions & 0 deletions setup.py
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',
]
}
)
12 changes: 12 additions & 0 deletions src/registrantalert/__init__.py
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
Loading

0 comments on commit d393785

Please sign in to comment.