Metadata-Version: 2.4
Name: accept
Version: 0.1.0
Summary: Parse and order a HTTP Accept header.
Home-page: http://github.com/rhyselsmore/accept
Author: Rhys Elsmore
Author-email: me@rhys.io
License: Copyright (c) 2015, Rhys Elsmore <me@rhys.io>
        
        Permission to use, copy, modify, and/or distribute this software for any
        purpose with or without fee is hereby granted, provided that the above
        copyright notice and this permission notice appear in all copies.
        
        THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: summary

accept
======


.. image:: https://travis-ci.org/rhyselsmore/accept.png?branch=master
        :target: https://travis-ci.org/rhyselsmore/accept

.. image:: https://pypip.in/d/accept/badge.png
        :target: https://pypi.python.org/pypi/accept


A simple library for parsing and ordering a HTTP Accept header.

Includes parameter extraction.


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

.. code-block:: bash

    pip install accept

Or if you *must* use easy_install:

.. code-block:: bash

    alias easy_install="pip install $1"
    easy_install accept


Usage
-----

.. code-block:: python

    >>> import accept
    >>> accept.parse("text/*, text/html, text/html;level=1, */*")
    [<Media Type: text/html; q=1.0; level=1>, <Media Type: text/html; q=1.0>, <Media Type: text/*; q=1.0>, <Media Type: */*; q=1.0>]
    >>> d = accept.parse("application/json; version=1; q=1.0; response=raw")[0]
    >>> d.media_type
    'application/json'
    >>> d.quality
    1.0
    >>> d.q
    1.0
    >>> d.params
    {'version': '1', 'response': 'raw'}
    >>> d['version']
    '1'
    >>> d['potato']
    None


Contribute
----------

#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet.
#. Fork `the repository`_ on Github to start making your changes to the **master** branch (or branch off of it).
#. Write a test which shows that the bug was fixed or that the feature works as expected.
#. Send a pull request and bug the maintainer until it gets merged and published.

.. _`the repository`: http://github.com/rhyselsmore/accept


History
-------

0.1.0 (2015-01-05)
++++++++++++++++++

* Initial Release!
