Metadata-Version: 2.0
Name: NetStorageKit
Version: 1.0.8
Summary: Akamai's NetStorage API communication kit
Home-page: https://github.com/MentaNetwork/NetStorageKit-Python
Author: Ernesto Mendoza Blanco
Author-email: ernestom@mentanetwork.com
License: MIT License
Download-URL: https://github.com/MentaNetwork/NetStorageKit-Python
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Requires-Dist: requests
Requires-Dist: responses
Requires-Dist: pytest
Requires-Dist: ntplib
Requires-Dist: pytest-cov
Requires-Dist: requests[security]

NetStorage communication Kit
============================
.. image:: https://img.shields.io/pypi/status/NetStorageKit.svg?style=flat-square
    :target: https://pypi.python.org/pypi/NetStorageKit

Usage
-----

The `tests <tests.py>`_ describe the usage thoroughly, but consider this upload
example.

.. code-block:: python

    import netstoragekit as ns

    # NetStorage connection information
    # The host part is prepended to -nsu.akamaihd.net, i.e. mycdn-nsu.akamaihd.net
    test = dict(key_name='abc', key='abcdefghijk1234'
                cpcode='12345', host='mycdn')

    # Create a Request instance
    request = ns.api.Request(test['key_name'], test['key'],
                             test['cpcode'], test['host'])

    remote_path = 'media/images/products/123.jpg'
    local_path = '/opt/data/products/123.jpg'

    # Upload the local path to the remote one (always relative to the CPCode)
    # The returned data is the XML returned by the API parsed as a python object
    # The response is the object as returned by the requests package
    data, response = request.upload(remote_path, local_path)

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

Development
~~~~~~~~~~~

.. code-block:: shell

    pip install autoenv
    pip install virtualenv
    virtualenv -p /usr/bin/python2.7.9 env
    source env/bin/activate
    python setup.py install
    # Run tests
    py.test tests.py

Production
~~~~~~~~~~

.. code:: shell

    pip install netstoragekit

.. _tests: tests.py


