Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisxmlapi committed May 4, 2021
0 parents commit 538434e
Show file tree
Hide file tree
Showing 25 changed files with 1,018 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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build
dist
/**/*.egg-info
/**/__pycache__
venv
.env
Dockerfile
run-tests.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-05-04)
------------------

* 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) 2020 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
85 changes: 85 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.. image:: https://img.shields.io/badge/License-MIT-green.svg
:alt: brand-alert-py license
:target: https://opensource.org/licenses/MIT

.. image:: https://img.shields.io/pypi/v/brand-alert.svg
:alt: brand-alert-py release
:target: https://pypi.org/project/brand-alert

.. image:: https://github.com/whois-api-llc/brand-alert-py/workflows/Build/badge.svg
:alt: brand-alert-py build
:target: https://github.com/whois-api-llc/brand-alert-py/actions

========
Overview
========

The client library for
`Brand Alert API <https://brand-alert.whoisxmlapi.com/>`_
in Python language.

The minimum Python version is 3.6.

Installation
============

.. code-block:: shell
pip install brand-alert
Examples
========

Full API documentation available `here <https://brand-alert.whoisxmlapi.com/api/documentation/making-requests>`_

Create a new client
-------------------

.. code-block:: python
from brandalert import *
client = Client('Your API key')
Make basic requests
-------------------

.. code-block:: python
# Get the number of domains.
result = client.preview(['google'])
print(result.domains_count)
# Get raw API response
raw_result = client.raw_data(
['google'],
response_format=Client.XML_FORMAT,
mode=Client.PREVIEW_MODE)
# Get list of recently registered/dropped domains (up to 10,000)
result = client.purchase(['google'])
Advanced usage
-------------------

Extra request parameters

.. code-block:: python
today = datetime.date.today()
delta = datetime.timedelta(days=10)
result = client.purchase(
['google'],
exclude_terms=['blog'],
since_date=today - delta,
with_typos=True,
punycode=False)
raw_result = client.raw_data(
['google'],
exclude_terms=['blog'],
since_date=today - delta,
with_typos=True,
punycode=False,
mode=Client.PURCHASE_MODE,
response_format=Client.JSON_FORMAT)
Empty file added __init__.py
Empty file.
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
76 changes: 76 additions & 0 deletions setup.py
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/brandalert/version.py'), version_content)

setup(
name='brand-alert',
version=version_content['VERSION'],
python_requires='>=3.6',
license='MIT',
description='Python client library for Brand 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/brand-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=[
'brand',
'alert',
'domain',
'api',
'whoisxmlapi',
],
install_requires=[
'requests',
],
extras_require={
'dev': [
'tox',
'flake8',
]
}
)
Empty file added src/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions src/brandalert/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
__all__ = ['Client', 'ErrorMessage', 'BrandAlertApiError', 'ApiAuthError',
'HttpApiError', 'EmptyApiKeyError', 'ParameterError',
'ResponseError', 'BadRequestError', 'UnparsableApiResponseError',
'ApiRequester', 'Domain', 'Response']

from .client import Client
from .net.http import ApiRequester
from .models.response import ErrorMessage, Domain, Response
from .exceptions.error import BrandAlertApiError, ParameterError, \
EmptyApiKeyError, ResponseError, UnparsableApiResponseError, \
ApiAuthError, BadRequestError, HttpApiError
Loading

0 comments on commit 538434e

Please sign in to comment.