diff --git a/README.md b/README.md index 24e1253..7e08d43 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,30 @@ -# Python TransIP +# python-transip -This is the Python client library for the TransIP API. - -This client library is not officially supported by TransIP. The library should still be considered incomplete and in development mode. This means that breaking changing may be introduced in the next release. - -## Documentation - -The full documentation will follow shortly. The example below should give an impression of the possibilities: +**python-transip** is an Python wrapper for the TransIP REST API. ```python -from transip import TransIP - -# Demo token, for more information see: -# https://api.transip.nl/rest/docs.html#header-demo-token -ACCESS_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImN3MiFSbDU2eDNoUnkjelM4YmdOIn0.eyJpc3MiOiJhcGkudHJhbnNpcC5ubCIsImF1ZCI6ImFwaS50cmFuc2lwLm5sIiwianRpIjoiY3cyIVJsNTZ4M2hSeSN6UzhiZ04iLCJpYXQiOjE1ODIyMDE1NTAsIm5iZiI6MTU4MjIwMTU1MCwiZXhwIjoyMTE4NzQ1NTUwLCJjaWQiOiI2MDQ0OSIsInJvIjpmYWxzZSwiZ2siOmZhbHNlLCJrdiI6dHJ1ZX0.fYBWV4O5WPXxGuWG-vcrFWqmRHBm9yp0PHiYh_oAWxWxCaZX2Rf6WJfc13AxEeZ67-lY0TA2kSaOCp0PggBb_MGj73t4cH8gdwDJzANVxkiPL1Saqiw2NgZ3IHASJnisUWNnZp8HnrhLLe5ficvb1D9WOUOItmFC2ZgfGObNhlL2y-AMNLT4X7oNgrNTGm-mespo0jD_qH9dK5_evSzS3K8o03gu6p19jxfsnIh8TIVRvNdluYC2wo4qDl5EW5BEZ8OSuJ121ncOT1oRpzXB0cVZ9e5_UVAEr9X3f26_Eomg52-PjrgcRJ_jPIUYbrlo06KjjX2h0fzMr21ZE023Gw" - -# Initialize a new TransIP API client -client = TransIP(access_token=ACCESS_TOKEN) - -# List all domains in your account -domains = client.domains.list() -for domain in domains: - print("Domain '{}' was registered at {}".format(domain.name, domain.registrationDate)) - -# List all vpss in your account -vpss = client.vpss.list() -for vps in vpss: - print("VPS '{}' is {}".format(vps.name, vps.status)) +>>> from transip import TransIP +>>> client = TransIP(access_token="REDACTED") +>>> domains = client.domains.list() +>>> domain = domains[0] +>>> domain.registrationDate +'2011-04-29' ``` -## Installation - -The installation instructions will follow shortly. - -## Supported Python Versions +[![Downloads](https://pepy.tech/badge/python-transip/month)](https://pepy.tech/project/python-transip/month) +[![Supported Versions](https://img.shields.io/pypi/pyversions/python-transip.svg)](https://pypi.org/project/python-transip) +[![Contributors](https://img.shields.io/github/contributors/roaldnefs/python-transip.svg)](https://github.com/roaldnefs/python-transip/graphs/contributors) -Python 3.6, 3.7, 3.8 and 3.9 are fully supported and tests. This library may work on later version of 3, but we do not currently run tests against those versions. +## Installing python-transip and Supported Versions -## Unsupported Python Version +**python-transip** is available on PyPI: -Python < 3.6 -## Third Party Libraries and Dependencies - -The following libraries be we installed when you install the client library: +```console +$ python -m pip install python-transip +``` -- [requests](https://github.com/psf/requests) +**python-transip** officially supports Python 3.6+. -## Contributing +## Documentation -The contributing instructions will follow shortly. +See the [docs folder](docs/index.rst) for more detailed instructions and additional documentation. diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +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) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..083f289 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,73 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +import os +import sys + +sys.path.append("../") +sys.path.append(os.path.dirname(__file__)) +import transip + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +sys.path.insert(0, os.path.abspath('..')) + + +# -- Project information ----------------------------------------------------- + +project = transip.__title__ +copyright = '2020, Roald Nefs' +author = transip.__author__ + +version = transip.__version__ +# The full version, including alpha/beta/rc tags +release = version + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "show_powered_by": False, + "github_user": "roaldnefs", + "github_repo": "python-transip", + "github_banner": True, + "show_related": False, + "note_bg": "#FFF59C", +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..0bdf74c --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,42 @@ +.. python-transip documentation master file, created by + sphinx-quickstart on Tue Dec 29 09:14:35 2020. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to python-transip's documentation! +========================================== + +Release v\ |version|. (:ref:`Installation `) + +.. image:: https://pepy.tech/badge/python-transip + :target: https://pepy.tech/project/python-transip + +.. image:: https://img.shields.io/pypi/l/python-transip.svg + :target: https://pypi.org/project/python-transip/ + +.. image:: https://img.shields.io/pypi/pyversions/python-transip.svg + :target: https://pypi.org/project/python-transip/ + +**python-transip** is an Python wrapper for the TransIP REST API. + +------------------- + +**Example usage**:: + + >>> from transip import TransIP + >>> client = TransIP(access_token="REDACTED") + >>> domains = client.domains.list() + >>> domain = domains[0] + >>> domain.registrationDate + '2011-04-29' + +**python-transip** allows you to create, read and update resources on TransIP +with ease. + +The User Guide +-------------- + +.. toctree:: + :maxdepth: 2 + + user/install diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/user/install.rst b/docs/user/install.rst new file mode 100644 index 0000000..50ce9d7 --- /dev/null +++ b/docs/user/install.rst @@ -0,0 +1,36 @@ +.. _install: + +Installation of python-transip +============================== + +This part of the documentation covers the installation of python-transip. +The first step to using any software package is getting it properly installed. + +Using pip +--------- + +To install python-transip, simply run this simple command in your terminal of +choice:: + + $ python -m pip install python-transip + +Get the Source Code +------------------- + +python-transip is actively developed on GitHub, where the code is +`available `_. + +You can either clone the public repository:: + + $ git clone git://github.com/roaldnefs/python-transip.git + +Or, download the `tarball `_:: + + $ curl -OL https://github.com/roaldnefs/python-transip/tarball/master + # optionally, zipball is also available (for Windows users). + +Once you have a copy of the source, you can embed it in your own Python +package, or install it into your site-packages easily:: + + $ cd python-transip + $ python -m pip install .