Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pika/pika
Browse files Browse the repository at this point in the history
  • Loading branch information
gmr committed Nov 4, 2015
2 parents 3b70ce4 + 8b14d7a commit ed0074b
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ And an example of writing a blocking consumer:
for method_frame, properties, body in channel.consume('test'):
# Display the message parts and ack the message
print method_frame, properties, body
print(method_frame, properties, body)
channel.basic_ack(method_frame.delivery_tag)
# Escape out of the loop after 10 messages
Expand All @@ -59,7 +59,7 @@ And an example of writing a blocking consumer:
# Cancel the consumer and return any pending messages
requeued_messages = channel.cancel()
print 'Requeued %i messages' % requeued_messages
print('Requeued %i messages' % requeued_messages)
connection.close()
Pika provides the following adapters
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/blocking_basic_get.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Example of getting a message and acknowledging it::
channel = connection.channel()
method_frame, header_frame, body = channel.basic_get('test')
if method_frame:
print method_frame, header_frame, body
print(method_frame, header_frame, body)
channel.basic_ack(method_frame.delivery_tag)
else:
print 'No message returned'
print('No message returned')
8 changes: 4 additions & 4 deletions docs/examples/blocking_consume.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Example of consuming messages and acknowledging them::


def on_message(channel, method_frame, header_frame, body):
print method_frame.delivery_tag
print body
print
channel.basic_ack(delivery_tag=method_frame.delivery_tag)
print(method_frame.delivery_tag)
print(body)
print()
channel.basic_ack(delivery_tag=method_frame.delivery_tag)


connection = pika.BlockingConnection()
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/blocking_consumer_generator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Example of consuming messages and acknowledging them::
for method_frame, properties, body in channel.consume('test'):

# Display the message parts
print method_frame
print properties
print body
print(method_frame)
print(properties)
print(body)

# Acknowledge the message
channel.basic_ack(method_frame.delivery_tag)
Expand All @@ -31,7 +31,7 @@ Example of consuming messages and acknowledging them::

# Cancel the consumer and return any pending messages
requeued_messages = channel.cancel()
print 'Requeued %i messages' % requeued_messages
print('Requeued %i messages' % requeued_messages)

# Close the channel and the connection
channel.close()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/blocking_delivery_confirmations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ The following code demonstrates how to turn on delivery confirmations with the B
body='Hello World!',
properties=pika.BasicProperties(content_type='text/plain',
delivery_mode=1)):
print 'Message publish was confirmed'
print('Message publish was confirmed')
else:
print 'Message could not be confirmed'
print('Message could not be confirmed')
6 changes: 3 additions & 3 deletions docs/examples/blocking_publish_mandatory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ The following example demonstrates how to check if a message is delivered by set

# Enabled delivery confirmations
channel.confirm_delivery()

# Send a message
if channel.basic_publish(exchange='test',
routing_key='test',
body='Hello World!',
properties=pika.BasicProperties(content_type='text/plain',
delivery_mode=1),
mandatory=True):
print 'Message was published'
print('Message was published')
else:
print 'Message was returned'
print('Message was returned')
2 changes: 1 addition & 1 deletion docs/examples/twisted_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Example of writing a consumer using the :py:class:`Twisted connection adapter <p
ch,method,properties,body = yield queue_object.get()

if body:
print body
print(body)

yield ch.basic_ack(delivery_tag=method.delivery_tag)

Expand Down
2 changes: 1 addition & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Example::
# Step #5
def handle_delivery(channel, method, header, body):
"""Called when we receive a message from RabbitMQ"""
print body
print(body)

# Step #1: Connect to RabbitMQ using the default parameters
parameters = pika.ConnectionParameters()
Expand Down
6 changes: 3 additions & 3 deletions examples/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def closeit():
properties=pika.BasicProperties(content_type='text/plain',
app_id='test',
delivery_mode=1)):
print 'Delivery not confirmed'
print('Delivery not confirmed')
else:
print 'Confirmed delivery'
print('Confirmed delivery')
channel.close()
connection.close()
duration = time.time() - start_time
print "Published %i messages in %.4f seconds (%.2f messages per second)" % (ITERATIONS, duration, (ITERATIONS/duration))
print("Published %i messages in %.4f seconds (%.2f messages per second)" % (ITERATIONS, duration, (ITERATIONS/duration)))
"""

0 comments on commit ed0074b

Please sign in to comment.