semvec/pypi-packages huggingface dataset:
django-feature-flipper 0.1.1
A simple, customisable, feature flipper
License: MIT

Feature Flipper
===============

A set of simple feature flipper template tags that can be easily extended.

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

To install this, simply ``pip install django-feature-flipper``.

Usage
-----

Configure your ``INSTALLED_APPS`` in ``settings.py``

.. code-block:: python

   INSTALLED_APPS = (
     ...
     'feature_flipper',
     ...
   )

This gives you access to the basic feature flipping models and template tags.
You can then use the basic ``FeatureFlipper`` that turns flags on and off
depending on your user, or customise your own.

Basic Feature Flipper
^^^^^^^^^^^^^^^^^^^^^

Set the flag choices in your ``settings.py`` file as:

.. code-block:: python

   FEATURE_FLIPPER_FLAGS = (
     ('simple_feature', u'Simple Feature'),
     ('beta_testing', u'Beta Testing'),
   )

When you add features, simply add flags here and your application will be able
to access the new flags immediately.

Custom Feature Flipper
^^^^^^^^^^^^^^^^^^^^^^

To customise the feature flipper you can just extend
``feature_flipper.models.AbstractFeatureFlipper`` with your own field. This
provides a major advantage over the basic flipper by letting you determine your
own reference for filtering out whether users get a feature or not.

First, extend the ``AbstractFeatureFlipper`` model:

.. code-block:: python

   from feature_flipper.models import AbstractFeatureFlipper


   class MyFeatureFlipper(AbstractFeatureFlipper):
     """
     """
     USER_FEATURE_FIELD = 'company'

     company = models.ForeignKey('myapp.Company')

The ``USER_FEATURE_FIELD`` sets the field that should be used for lookups when
determining whether to show the feature to a user. The final part is to
reference this in your ``settings.py``\ :

.. code-block:: python

   FEATURE_FLIPPER_MODEL = 'myapp.MyFeatureFlipper',

Using in Templates
------------------

To use the feature flipper in your templates, just load the ``feature_flipper``
library and use the ``flipper`` template tag:

.. code-block:: html

   {% load feature_flipper %}

   <ul class="features">
     {% flipper request.user "simple_feature" %}
     <li><a href="/simple">Simple feature</a></li>
     {% endflipper %}

     {% flipper request.user "beta_testing" %}
     <li><a href="/testing">Beta-testing feature</a></li>
     {% endflipper %}
   </ul>

The ``feature`` tag
^^^^^^^^^^^^^^^^^^^^^^^

The ``feature`` template tag is a simple template tag that takes two arguments:


#. The user requesting access
#. The feature string to check for

For custom feature flippers, the ``user`` argument is simply the alternative user
identifier, for example the user's organisation.

Supported Django Versions
-------------------------

This supports Django 1.9 and later.

.. list-table::
   :header-rows: 1

   * - Feature Flipper
     - Django
   * - 0.0.7
     - 1.9
epages-rest-python 0.9.0
The ePages online shop API for Python
License: MIT

ePages REST API for Python
==========================

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://github.com/ooz/epages-rest-python

.. image:: https://travis-ci.org/ooz/epages-rest-python.svg?branch=master
    :target: https://travis-ci.org/ooz/epages-rest-python

.. image:: https://badge.fury.io/py/epages-rest-python.svg
    :target: https://badge.fury.io/py/epages-rest-python

------------

See `ePages API <https://developer.epages.com/apps>`_ for detailed documentation.

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

Using ``pip``::

    pip install epages-rest-python

Usage
-----

::

    import epages

    api_url = 'https://your.domain.com/rs/shops/yourShopName'
    token = 'yOuRaPiKeYhErE'
    client = epages.RESTClient(api_url,
                               token) # optional for public resources

    # Get the shop information
    shop = client.get('')
    # or
    shop = client.get('/')
    # or
    shop = client.get(api_url)
    print(shop)

    # Create a new product
    payload = {
        'productNumber': '1337'
    }
    new_product = client.post('/products', json=payload)
    print(new_product)

Works with `ePages Now v2 (beyond) shops <https://signup.beyondshop.cloud/>`_, too:

::

    import epages
    client = epages.BYDClient('https://yourshop.beyondshop.cloud/api',
                              'client-id-of-your-app',
                              'client-secret-of-your-app')

    shop = client.get('/shop')

    print(shop['name'])

For more examples see the `epages-rest-python-examples <https://github.com/ooz/epages-rest-python-examples>`_ repository.

Testing
-------

Executing the tests requires a `developer shop <https://developer.epages.com/#modal-popup>`_.

::

    cp run_tests.sh.template run_tests.sh

    # Edit run_tests.sh: enter your ePages API URL and access token

    make test