mirror of
https://github.com/sprockets/sprockets.mixins.avro-publisher.git
synced 2024-12-03 03:00:23 +00:00
Update the README example
This commit is contained in:
parent
9932e011d4
commit
6131829c59
1 changed files with 3 additions and 8 deletions
11
README.rst
11
README.rst
|
@ -12,7 +12,7 @@ and can be installed via ``pip`` or ``easy_install``:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
pip install sprockets.mixins.avro_publisher
|
pip install sprockets.mixins.avro-publisher
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
@ -30,8 +30,6 @@ This examples demonstrates the most basic usage of ``sprockets.mixins.avro-publi
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from tornado import gen
|
from tornado import gen
|
||||||
from tornado import web
|
from tornado import web
|
||||||
from sprockets.mixins import avro_publisher
|
from sprockets.mixins import avro_publisher
|
||||||
|
@ -41,12 +39,9 @@ This examples demonstrates the most basic usage of ``sprockets.mixins.avro-publi
|
||||||
@gen.coroutine
|
@gen.coroutine
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
body = {'request': self.request.path, 'args': args, 'kwargs': kwargs}
|
body = {'request': self.request.path, 'args': args, 'kwargs': kwargs}
|
||||||
yield self.amqp_publish('exchange', 'routing.key', json.dumps(body),
|
yield self.amqp_publish('exchange', 'routing.key', body,
|
||||||
{'content_type': avro_publisher.DATUM_MIME_TYPE,
|
{'content_type': avro_publisher.DATUM_MIME_TYPE,
|
||||||
'type': 'avro-schema-name'
|
'type': 'avro-schema-name'})
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
settings = {'avro_schema_uri_format': 'http://my-schema-repository/%(name)s.avsc'}
|
settings = {'avro_schema_uri_format': 'http://my-schema-repository/%(name)s.avsc'}
|
||||||
application = web.Application([(r"/", RequestHandler),],
|
application = web.Application([(r"/", RequestHandler),],
|
||||||
|
|
Loading…
Reference in a new issue