Skip to content

Commit

Permalink
[fea] add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mosquito committed Sep 28, 2016
1 parent 9af26bb commit a4f9ca5
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-exclude tests *
recursive-exclude __pycache__ *
exclude .*

include README.rst
83 changes: 83 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
aio-pika
========

.. image:: https://travis-ci.org/mosquito/aio-pika.svg
:target: https://travis-ci.org/mosquito/aio-pika

.. image:: https://img.shields.io/pypi/v/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/
:alt: Latest Version

.. image:: https://img.shields.io/pypi/wheel/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/

.. image:: https://img.shields.io/pypi/pyversions/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/

.. image:: https://img.shields.io/pypi/l/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/


Wrapper for the PIKA for asyncio and humans.


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

.. code-block:: shell
pip install aio-pika
Usage example
--------------

.. code-block:: python
import asyncio
from aio_pika import connect
@acyncio.coroutine
def main(loop):
connection = yield from connect("amqp://guest:[email protected]/", loop=loop)
queue_name = "test_queue"
routing_key = "test_queue"
# Creating channel
channel = yield from connection.channel()
# Declaring exchange
exchange = yield from channel.declare_exchange('direct', auto_delete=True)
# Declaring queue
queue = yield from channel.declare_queue(queue_name, auto_delete=True)
# Binding queue
yield from queue.bind(exchange, routing_key)
yield from exchange.publish(
Message(
bytes('Hello', 'utf-8'),
content_type='text/plain',
headers={'foo': 'bar'}
),
routing_key
)
# Receiving message
incoming_message = yield from queue.get(timeout=5)
# Confirm message
incoming_message.ack()
yield from queue.unbind(exchange, routing_key)
yield from queue.delete()
yield from connection.close()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
4 changes: 2 additions & 2 deletions aio_pika/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .connection import Connection, connect, connect_url
from .channel import Channel
from .exchange import Exchange
from .exchange import Exchange, ExchangeType
from .message import Message, IncomingMessage
from .queue import Queue
from .exceptions import AMQPException, MessageProcessError
Expand All @@ -9,5 +9,5 @@
__all__ = (
'connect', 'connect_url', 'Connection',
'Channel', 'Exchange', 'Message', 'IncomingMessage', 'Queue',
'AMQPException', 'MessageProcessError',
'AMQPException', 'MessageProcessError', 'ExchangeType'
)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# @copyright (c) 2002-2016 Acronis International GmbH. All rights reserved.
from setuptools import setup, find_packages


setup(
name='aio-pika',
version='0.5.0',
version='0.5.1',
author="Dmitry Orlov <[email protected]>",
author_email="[email protected]",
license="Apache Software License",
description="Wrapper for the PIKA for asyncio and humans.",
long_description=open("README.rst").read(),
platforms="all",
classifiers=(
'License :: OSI Approved :: Apache Software License',
Expand Down

0 comments on commit a4f9ca5

Please sign in to comment.