From f950fcd318fa518b5e89ffab4da4e851861833c3 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sat, 17 Nov 2012 08:25:15 -0500 Subject: [PATCH] Sloppy commit. Both re-namespacing and using the amqp uri env var. --- sylvilagus/python/sylvilagus/{chapter02 => ch02}/__init__.py | 0 .../python/sylvilagus/{chapter02 => ch02}/hello_world.py | 5 +++-- .../sylvilagus/{chapter02 => ch02}/hello_world_consumer.py | 2 +- .../sylvilagus/{chapter02 => ch02}/hello_world_producer.py | 2 +- .../hello_world_producer_with_confirms.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) rename sylvilagus/python/sylvilagus/{chapter02 => ch02}/__init__.py (100%) rename sylvilagus/python/sylvilagus/{chapter02 => ch02}/hello_world.py (85%) rename sylvilagus/python/sylvilagus/{chapter02 => ch02}/hello_world_consumer.py (94%) rename sylvilagus/python/sylvilagus/{chapter02 => ch02}/hello_world_producer.py (92%) rename sylvilagus/python/sylvilagus/{chapter02 => ch02}/hello_world_producer_with_confirms.py (93%) diff --git a/sylvilagus/python/sylvilagus/chapter02/__init__.py b/sylvilagus/python/sylvilagus/ch02/__init__.py similarity index 100% rename from sylvilagus/python/sylvilagus/chapter02/__init__.py rename to sylvilagus/python/sylvilagus/ch02/__init__.py diff --git a/sylvilagus/python/sylvilagus/chapter02/hello_world.py b/sylvilagus/python/sylvilagus/ch02/hello_world.py similarity index 85% rename from sylvilagus/python/sylvilagus/chapter02/hello_world.py rename to sylvilagus/python/sylvilagus/ch02/hello_world.py index d5edff1..a389d3e 100644 --- a/sylvilagus/python/sylvilagus/chapter02/hello_world.py +++ b/sylvilagus/python/sylvilagus/ch02/hello_world.py @@ -1,9 +1,10 @@ +import os + import pika def get_conn_params(): - credentials = pika.PlainCredentials('guest', 'guest') - return pika.ConnectionParameters('localhost', credentials=credentials) + return pika.URLParameters(os.environ['SYLVILAGUS_AMQP_URI']) def get_nonblocking_channel(declare_exchange=True): diff --git a/sylvilagus/python/sylvilagus/chapter02/hello_world_consumer.py b/sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py similarity index 94% rename from sylvilagus/python/sylvilagus/chapter02/hello_world_consumer.py rename to sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py index e1802e4..edf817f 100644 --- a/sylvilagus/python/sylvilagus/chapter02/hello_world_consumer.py +++ b/sylvilagus/python/sylvilagus/ch02/hello_world_consumer.py @@ -4,7 +4,7 @@ import sys import pika -from sylvilagus.chapter02 import hello_world +from sylvilagus.ch02 import hello_world def msg_consumer(channel, method, header, body): diff --git a/sylvilagus/python/sylvilagus/chapter02/hello_world_producer.py b/sylvilagus/python/sylvilagus/ch02/hello_world_producer.py similarity index 92% rename from sylvilagus/python/sylvilagus/chapter02/hello_world_producer.py rename to sylvilagus/python/sylvilagus/ch02/hello_world_producer.py index 96e78a5..04142af 100644 --- a/sylvilagus/python/sylvilagus/chapter02/hello_world_producer.py +++ b/sylvilagus/python/sylvilagus/ch02/hello_world_producer.py @@ -4,7 +4,7 @@ import sys import pika -from sylvilagus.chapter02 import hello_world +from sylvilagus.ch02 import hello_world def main(args=sys.argv[:]): diff --git a/sylvilagus/python/sylvilagus/chapter02/hello_world_producer_with_confirms.py b/sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py similarity index 93% rename from sylvilagus/python/sylvilagus/chapter02/hello_world_producer_with_confirms.py rename to sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py index 30c91ab..579e2a6 100644 --- a/sylvilagus/python/sylvilagus/chapter02/hello_world_producer_with_confirms.py +++ b/sylvilagus/python/sylvilagus/ch02/hello_world_producer_with_confirms.py @@ -5,7 +5,7 @@ import sys import pika -from sylvilagus.chapter02 import hello_world +from sylvilagus.ch02 import hello_world def main(sysargs=sys.argv[:]):