Skip to content

Commit

Permalink
minor code review; migrated to sphinx documenation
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed Jul 12, 2018
1 parent 8f5019d commit da40a40
Show file tree
Hide file tree
Showing 174 changed files with 24,833 additions and 80 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -64,7 +64,9 @@ instance/
.scrapy

# Sphinx documentation
docs/_build/
!docs/_build/
docs/_build/*
!docs/_build/html

# PyBuilder
target/
Expand Down
7 changes: 7 additions & 0 deletions AUTHORS.md
@@ -0,0 +1,7 @@
> ⚠ This document _only_ reflects the responsible developers at HEXONET GmbH. For a list of MUCH-APPRECIATED CONTRIBUTORS -- people who helped developing and extending this library, applying patches, adding helpful comments
and thus generally made it that much better, see [GitHub's list of contributors](https://github.com/hexonet/python-sdk/contributors).

# HEXONET Developers

* [Anthony Schneider](//github.com/isharky) - Original Implementation
* [Kai Schwarz](//github.com/papakai) - Full Review
22 changes: 22 additions & 0 deletions docs/Makefile
@@ -0,0 +1,22 @@
# Minimal makefile for Sphinx documentation
#

PYTHON ?= python3

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = hexonet.apiconnector
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c8cb18a66d0bdee5507e48163ae9d7cf
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added docs/_build/html/_images/hexonet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions docs/_build/html/_sources/api.rst.txt
@@ -0,0 +1,11 @@
.. _api:

SDK Documentation
=================

Information on specific functions, classes, and methods.

.. toctree::
:glob:

api/*
27 changes: 27 additions & 0 deletions docs/_build/html/_sources/api/hexonet.apiconnector.rst.txt
@@ -0,0 +1,27 @@
hexonet.apiconnector package
============================

.. automodule:: hexonet.apiconnector
:members:
:undoc-members:
:show-inheritance:

Submodules
----------

.. automodule:: hexonet.apiconnector.connection
:members:
:undoc-members:
:show-inheritance:

.. automodule:: hexonet.apiconnector.response
:members:
:undoc-members:
:show-inheritance:

.. automodule:: hexonet.apiconnector.util
:members:
:undoc-members:
:show-inheritance:


4 changes: 4 additions & 0 deletions docs/_build/html/_sources/changelog.rst.txt
@@ -0,0 +1,4 @@
Changelog
=========

.. include:: ../HISTORY.md
73 changes: 73 additions & 0 deletions docs/_build/html/_sources/config.rst.txt
@@ -0,0 +1,73 @@
.. _config:

Configuration Handling
======================

Applications need some kind of configuration. There are different settings
you might want to change depending on the application environment like
toggling the debug mode, setting credentials etc.

The way hexonet.apiconnector is designed usually requires the configuration to be
provided at runtime when connecting to the HEXONET Backend API. You can hardcode
the configuration in the code, which for many small scripts is for sure sufficient.
Realtime applications and frontends need to cover some application logic around
using this SDK like a login form and session management.


Configuration Basics
--------------------

The configuration can be provided in two ways.
Using the :meth:`hexonet.apiconnector.connect`::
import hexonet.apiconnector
api = hexonet.apiconnector.connect(
"test.user",
"test.passw0rd",
"https://coreapi.1api.net/api/call.cgi",
"1234"
//,"hexotestman.com" //subuser view
//,"testrole" //specify a role user
);

or by using the :class:`hexonet.apiconnector.connection.Connection` class accordingly::

from hexonet.apiconnector.connection import Connection as HXClient
api = HXClient({
"login": "test.user",
"password": "test.passw0rd",
"url": "https://coreapi.1api.net/api/call.cgi",
"entity": "1234",
//"user": "hexotestman.com",//subuser view
//"role": "testrole",//specify a role user
});


Environment and Debug Features
------------------------------

HEXONET provides two different Backend Systems that you might consider to use:

- Operational Test & Evaluation (OT&E) System (set 'entity' to '1234')
No costs, just for playing around with things. This system can be seen as a
kind of sandbox system that allows to test your integration first before going
live with it. This system and the use of our products and services is completely
free of charge.

- LIVE System (set 'entity' to '54cd')
The real world system - This system and the use our services and products can lead
to real costs depending on what you're exactly doing.

Both systems need a separate registration_ first.

.. _registration: https://www.hexonet.net

Debug Features, are up to now not available at the hexonet.apiconnector, but planned.


Builtin Configuration Values
----------------------------

The following configuration values are used internally by hexonet.apiconnector:

Up to now - none, but this might change in future as we are continously improve our SDKs.
23 changes: 23 additions & 0 deletions docs/_build/html/_sources/contactus.rst.txt
@@ -0,0 +1,23 @@
.. _contact-us:

Contact Us
==========

There are several possibilities to get in touch with us, we list them in our preferred order.

- `Slack`_

- `Stack Overflow`_

- The listed authors in :ref:`authors`

- our `Support`_

.. _Slack: https://hexonet-sdk.slack.com/messages/CBF4RM7KK
.. _Stack Overflow: https://stackoverflow.com/questions/tagged/python-sdk
.. _Support: https://hexonet.support

Please file Bugs / Issues / Problems as `new github issue`_ to us.
Please read our :ref:`contributing` first and use the search to check if this is already a known issue.

.. _new github issue: https://github.com/hexonet/python-sdk/issues/new
6 changes: 6 additions & 0 deletions docs/_build/html/_sources/contributing.rst.txt
@@ -0,0 +1,6 @@
.. _contributing:

Contributing
============

.. include:: ../CONTRIBUTING.md
7 changes: 7 additions & 0 deletions docs/_build/html/_sources/debugging.rst.txt
@@ -0,0 +1,7 @@
.. _debugging:

Debugging
=========

There's no debug feature available in hexonet.apiconnector up to now.
This is a planned feature and will come in near future as we continously improve our SDKs.
28 changes: 28 additions & 0 deletions docs/_build/html/_sources/foreword.rst.txt
@@ -0,0 +1,28 @@
Foreword
========

Read this before you get started with hexonet.apiconnector. This hopefully answers some
questions about the purpose and goals of the project.

HEXONET
-------
We're known as leading developers of domain technologies and as the worldwide experts in
domain names. Our team is focused, and continually driven to bring customers the best
technological solutions, TLD offerings, customer support, and domain products to make their
internet goals a reality. Whether you have one domain or tens of thousands with us, we
appreciate your business.

Read more about us and our products and service on our homepage_.

.. _homepage: https://www.hexonet.net/aboutus

HEXONET Backend API
-------------------

HEXONET provides his products and services through a Backend System that is accessible by different options.
One of these options is a HTTP API for which we provide SDKs in different programming languages such as
go/golang, nodejs, php, python, java and perl.
The hexonet.apiconnector (aka python-sdk) is one of these connector libraries that help implementors to connect
their systems to the HEXONET Backend System.

Continue to :ref:`installation` or the :ref:`quickstart`.
19 changes: 19 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
@@ -0,0 +1,19 @@
:orphan:

Welcome to hexonet.apiconnector
===============================

.. image:: _static/hexonet.png
:alt: hexonet.apiconnector: Connector library for the HEXONET Backend API
:align: right

Welcome to hexonet.apiconnector's documentation. Get started with :ref:`installation`
and then get an overview with the :ref:`quickstart`. There is also a Demo App available for
any of our SDK libraries. The one for hexonet.apiconnector (python-sdk) is available at github_.

.. _github: https://github.com/hexonet/python-sdk-demo

The rest of the docs describe each component of hexonet.apiconnector in detail, with a full
reference in the :ref:`api` section.

.. include:: contents.rst.inc
33 changes: 33 additions & 0 deletions docs/_build/html/_sources/installation.rst.txt
@@ -0,0 +1,33 @@
.. _installation:

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

Python Version
--------------

We recommend using the latest version of Python 3. hexonet.apiconnector supports Python 3.x and 2.7.


Dependencies
------------

There are NO dependencies to install. If this changes, we will list them here and they will be installed
automatically when hexonet.apiconnector is getting installed.


Installation
-------------

Within the your environment, use the following command to install hexonet.apiconnector:

.. code-block:: sh
pip install hexonet.apiconnector
# for python 2.x
pip3 install hexonet.apiconnector
# for python 3.x
The connector library is now installed. Check out the :doc:`/quickstart` or go to the
:doc:`Documentation Overview </index>`.
36 changes: 36 additions & 0 deletions docs/_build/html/_sources/license.rst.txt
@@ -0,0 +1,36 @@
License
=======

hexonet.apiconnector is licensed under MIT License.
A short, permissive software license. Basically, you can do whatever you
want as long as you include the original copyright and license notice in
any copy of the software/source.

The full license text can be found below (:ref:`mit-license`).

.. _authors:

Authors
-------

.. include:: ../AUTHORS.md

General License Definitions
---------------------------

The following section contains the full license texts for this module and the
documentation.

- "AUTHORS" hereby refers to all the authors listed in the
:ref:`authors` section.

- The ":ref:`mit-license`" applies to all the source code shipped as
part of hexonet.apiconnector (the module itself as well as the examples and the unittests)
as well as documentation.

.. _mit-license:

MIT License
-------------

.. include:: ../LICENSE
44 changes: 44 additions & 0 deletions docs/_build/html/_sources/quickstart.rst.txt
@@ -0,0 +1,44 @@
.. _quickstart:

Quickstart
==========

Eager to get started? This page gives a good introduction to hexonet.apiconnector.
It assumes you already have it installed. If you do not, head over to the
:ref:`installation` section.


A Minimal Application
---------------------

A minimal application using hexonet.apiconnector looks something like this:

.. literalinclude:: app.py
:language: python
:encoding: utf-8
:caption: Python SDK Demo App

So what did that code do?

1. First we imported the :mod:`hexonet.apiconnector`.

2. Next we create an Connection to the HEXONET Backend System by using the :meth:`~hexonet.apiconnector.connect`.

3. We then use the :meth:`~hexonet.apiconnector.connection.Connection.call` to request a provided command to the backend system.

4. The response is an instance of :class:`~hexonet.apiconnector.response.Response`. It provides all necessary methods to access API response data.

What to do if the backend system just returns an error
------------------------------------------------------

Well this in general needs some further analysis. Reasons might be that you have an ip filter defined and you do not provide your ip address through configuration option "remoteaddr".
It could also be that you provided an ip address that is blocked.
Another issue can be that you connect using a role user that is not allowed to request this command as it got blocked by role user configuration.

Feel free to :ref:`contact-us` if you need help.

Sessions
--------

Session-based communication is not yet available in this SDK. This is a planned rewrite.
The above application code shows how sessionless communication with the HEXONET Backend API works.

0 comments on commit da40a40

Please sign in to comment.