/opensrs

A Python client for OpenSRS

Primary LanguagePythonMIT LicenseMIT

OpenSRS

Build Status

Usage

Looking up statuses of domains

>>> from opensrs import OpenSRS
>>> client = OpenSRS(host, port, username, private_key, default_timeout)
>>> client.suggest_domains('foo', ['.COM', '.ORG', '.NET', '.INFO'], 4))
{
    'lookup': [
        {'status': 'taken', 'domain': 'foo.com'},
        {'status': 'taken', 'domain': 'foo.net'},
        {'status': 'taken', 'domain': 'foo.org'},
        {'status': 'taken', 'domain': 'foo.info'},
    ],
    'suggestion': [
        {'status': 'available', 'domain': 'fooonline.com'},
        {'status': 'available', 'domain': 'fooonline.net'},
        {'status': 'available', 'domain': 'fooonline.org'},
        {'status': 'available', 'domain': 'fooonline.info'},
    ]
}

Configuration

The service client is configured on initialization.

from opensrs import OpenSRS
client = OpenSRS(host, port, username, private_key, default_timeout)

Testing

Install requirements:

pip install -r requirements.txt

Create the test_settings.py file in the root directory with properly populated CONNECTION_OPTIONS. Use test_settings.py.example as an example.

Run the tests with:

nosetests

Or you can easily run tests on Python 2.7 with tox:

tox