Skip to content

Commit

Permalink
docs and readme fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Rybakov committed Aug 17, 2023
1 parent ed29260 commit a8ef14d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 42 deletions.
54 changes: 30 additions & 24 deletions docs/deker/connecting_to_server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
Connecting to Server
********************

To access data remotely stored on [OpenWeather](https://openweathermap.org) managed Deker server infrastructure, you need to use server adapters
.. _OpenWeather: https://openweathermap.org
.. _Installation page: installation.html

To access remotely the data stored on OpenWeather_ managed Deker server infrastructure, you need
to use server adapters.

It is an original OpenWeather plugin, based on `httpx <https://www.python-httpx.org/>`_
with HTTP 2.0 support that allows your local client to communicate with remote server instances of Deker.
with HTTP 2.0 support, that allows your local client to communicate with remote OpenWeather
public server instances of Deker.

Deker will automatically find and initialize this plugin if it is installed in current environment.

Expand All @@ -15,36 +20,39 @@ Deker will automatically find and initialize this plugin if it is installed in c

Usage
=========
To use server version, you have to initialize Deker's Client with an uri which contains ``http/https`` schema.
To use server version, you have to initialize Deker's Client with an uri which contains
``http/https`` scheme.

.. code-block:: python
from deker import Client
client = Client("http://{url-to-deker-server}") # As simple as that
And now the client will communicate with Deker server
And now the client will communicate with Deker server.

If authentication is enabled on the Deker server, you can provide credentials by adding it yo the url like this:
If authentication is enabled on the Deker server, you can provide credentials by adding it
to the url like this:

.. code-block:: python
from deker import client
client = Client("https://{username}:{password}@{url-to-deker-server}")
Configuration
=============
Server adapters use ``httpx client`` under the hood. You can configure its behaviour by passing
keyword arguments to the ``httpx_conf`` argument of the Deker's Client
keyword arguments to the ``httpx_conf`` parameter of the Deker's Client:

.. code-block:: python
import httpx
from deker import Client
limits = httpx.Limits(max_keepalive_connections=5, max_connections=10)
client = Client("http://{url-to-deker-server}", httpx_conf={'http2': False, 'timeout': 10, 'limits': limits})
Full list of available config you can find at `httpx website <https://www.python-httpx.org/api/#client>`_
client = Client(
"http://{url-to-deker-server}",
httpx_conf={'http2': False, 'timeout': 10, 'limits': limits}
)
By default, adapters' ``httpx client`` has following settings:

Expand All @@ -64,47 +72,45 @@ By default, adapters' ``httpx client`` has following settings:
- Optional[float]
- None

The full list of ``httpx`` configuration parameters you can find at `the official website`_.

.. _the official website: https://www.python-httpx.org/api/#client

Errors
=========

.. py:exception:: DekerServerError(response: Response, message: str)
Bases: :class:`DekerBaseApplicationError`
Server error, which is raised on any non-specific ocasion (like 5xx status from server)

Server error, which is raised on any non-specific occasion (like 5xx status from server)

:param response: Httpx Response
:param message: Message of exception

.. py:exception:: DekerTimeoutServer
Bases: :class:`DekerServerError`

This exception is raised on any timeout (Httpx's Timeout exception or 504 status )
This exception is raised on any timeout (Httpx's Timeout exception or 504 status)

.. py:exception:: DekerBaseRateLimitError(message: str, limit: Optional[int], remaining: Optional[int], reset: Optional[int])
Bases: :class:`DekerBaseApplicationError`



:param message: Exception message
:param limit: What is the limit for the user (requests per second)
:param remaining: How much is left (requests per second)
:param limit: Requests per second limit for the user
:param remaining: How many requests per second are left
:param reset: When limits will be reset

.. py:exception:: DekerRateLimitError
Bases: :class:`DekerBaseRateLimitError`


If user's limit is exceeded
If user's rate limit is exceeded

.. py:exception:: DekerDataPointsLimitError
Bases: :class:`DekerBaseRateLimitError`

If requested subset exceeds quota

.. _Installation page: installation.html

60 changes: 42 additions & 18 deletions docs/deker/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,66 +40,90 @@ Also please not that for flexibility few internal Deker components are published
packages:

* ``deker-local-adapters``
* ``deker-server-adapters``
* ``deker-tools``

To install Deker with all the previously mentioned dependencies, run::
To install Deker run:

.. code-block:: bash
pip install deker
Optional Packages
-----------------

Deker also supports output of its data as pandas_ or Xarray_ via the following package:
Deker also supports output of its data as Xarray_ via the following package:

* ``xarray`` >= 2023.5.0

To install it with ``xarray`` optional dependency::
To install it with ``xarray`` optional dependency:

.. code-block:: bash
pip install deker[xarray]
.. _Xarray: https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
.. _pandas: https://pandas.pydata.org/getting_started.html

Deker Tools
===========

``deker-tools`` is an out-of-box battery which provides several useful tools and utilities to work
with Deker data. You may find this package useful in your projects, even if they are not related to
Deker.

To install Deker tools package, run:

.. code-block:: bash
pip install deker-tools
Interactive Shell
=================

``deker-shell`` is an interactive environment that enables you to manage and access Deker storage
in a convenient way. It requires ``deker`` package to be installed manually before use as described
in a convenient way. It requires ``deker`` package to be installed **manually** before use as described
above.

To install interactive shell package::
To install interactive shell package, run:

pip install deker deker-shell
.. code-block:: bash
pip install deker deker-shell
Deker Tools
===========
Or you can install it alongside with Deker by:

``deker-tools`` is an out-of-box battery which provides several useful tools and utilities to work
with Deker data. You may find this package useful in projects, even if they are not related to
Deker.
.. code-block:: bash
To install Deker tools package::
pip install deker[shell]
pip install deker-tools
Server Adapters
===============
.. _plugin: connecting_to_server.html

It is an original OpenWeather plugin, based on `httpx <https://www.python-httpx.org/>`_
with HTTP 2.0 support that allows to your local client communicate with remote server instances of Deker.
It is an original OpenWeather plugin_, based on `httpx <https://www.python-httpx.org/>`_
with HTTP 2.0 support, that allows your local client to communicate with remote OpenWeather
public server instances of Deker.

If you don't have Deker yet
If you don't have Deker yet, run

.. code-block:: bash
pip install deker[server-adapters]
If you already have installed Deker, you can simply install plugin to use it.
If you have already installed Deker, you can simply install plugin to use it by:

.. code-block:: bash
pip install deker-server-adapters
Install all the options at once
=================================
You can install all the above mentioned options at once by:

.. code-block:: bash
pip install deker[all]

0 comments on commit a8ef14d

Please sign in to comment.