Advanced Usage
==============

Query Preprocessors
-------------------

InfiniSDK allows modification of HTTP request just before they are sent to the system through a mechanism query preprocessors.

The system objects exposes a context manager called `api.query_preprocessor`. This context manager gets a function which can modify the request before it is sent.

.. code-block:: python

    def unapproved(request):
        request.url = request.url.set_query_param('approved', 'false')

    with infinibox.api.query_preprocessor(unapproved):
        # Actions that require approval will be rejected within this context

Passing special values for fields
---------------------------------

InfiniSDK supports a few special values for fields.

Among them, you can find Autogenerate, used to get autogenerated field values upon request, and RawValue, that will pass the values as-is.
