forked from mosquito/aio-pika
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
recursive-exclude tests * | ||
recursive-exclude __pycache__ * | ||
exclude .* | ||
|
||
include README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
|