From bf7fbeea6390e0e63794630325bba666fe1aa17d Mon Sep 17 00:00:00 2001 From: Marcos Pereira Date: Tue, 15 Aug 2017 15:07:46 -0300 Subject: [PATCH] Updated docs --- docs/source/conf.py | 20 +++++++-- docs/source/index.md | 22 ---------- docs/source/index.rst | 100 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 25 deletions(-) delete mode 100644 docs/source/index.md create mode 100644 docs/source/index.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index f831a73..51e3f6a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,7 +31,12 @@ import sphinx_rtd_theme # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.autodoc'] +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.viewcode', +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -40,7 +45,7 @@ templates_path = ['_templates'] # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.md' +source_suffix = '.rst' # The master toctree document. master_doc = 'index' @@ -71,11 +76,14 @@ language = None # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +add_function_parentheses = False +add_module_names = True + # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False +todo_include_todos = True # -- Options for HTML output ---------------------------------------------- @@ -97,6 +105,12 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] + +html_use_smartypants = False +html_show_sourcelink = False +html_show_sphinx = False +html_show_copyright = True + # Custom sidebar templates, must be a dictionary that maps document names # to template names. # diff --git a/docs/source/index.md b/docs/source/index.md deleted file mode 100644 index d852fe4..0000000 --- a/docs/source/index.md +++ /dev/null @@ -1,22 +0,0 @@ -.. python-keycloak documentation master file, created by - sphinx-quickstart on Tue Aug 15 11:02:59 2017. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to python-keycloak's documentation! -=========================================== - -Contents: - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..9a6e48b --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,100 @@ +.. python-keycloak documentation master file, created by + sphinx-quickstart on Tue Aug 15 11:02:59 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. image:: https://travis-ci.org/marcospereirampj/python-keycloak.svg?branch=master + :target: https://travis-ci.org/marcospereirampj/python-keycloak + +.. image:: https://readthedocs.org/projects/python-keycloak/badge/?version=latest + :target: http://python-keycloak.readthedocs.io/en/latest/?badge=latest + + +Welcome to python-keycloak's documentation! +=========================================== + +**python-keycloak** is a Python package providing access to the Keycloak API. + +Installation +================== + +Via Pypi Package:: + + $ pip install python-keycloak + +Manually:: + + $ python setup.py install + +Dependencies +================== + +python-keycloak depends on: + +* Python 3 +* `requests `_ + +Tests Dependencies +------------------ + +* unittest +* `httmock `_ + +Bug reports +================== + +Please report bugs and feature requests at +`https://github.com/marcospereirampj/python-keycloak/issues `_ + +Documentation +================== + +The documentation for python-keycloak is available on `readthedocs `_. + +Usage +===== + +Main methods:: + + from keycloak import Keycloak + + # Configure client + keycloak = Keycloak(server_url="http://localhost:8080/auth/", + client_id="example_client", + realm_name="example_realm", + client_secret_key="secret") + + # Get WellKnow + config_well_know = keycloak.well_know() + + # Get Token + token = keycloak.token("user", "password") + + # Get Userinfo + userinfo = keycloak.userinfo(token['access_token']) + + # Logout + keycloak.logout(token['refresh_token']) + + # Get Certs + certs = keycloak.certs() + + # Get RPT (Entitlement) + token = keycloak.token("user", "password") + rpt = keycloak.entitlement(token['access_token'], "resource_id") + + # Instropect + keycloak.instropect(token['access_token'], rpt['rpt']) +