summaryrefslogtreecommitdiff
path: root/python/examples/api/hello_xml
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2013-09-18 21:15:16 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2013-09-18 21:15:16 +0000
commit199bdab9674606e379654db00913cc27ff702a92 (patch)
tree09133c98d6d6e4959a881b4ed88f419432329dc4 /python/examples/api/hello_xml
parentaa0e0128fe64a766e93d00824f4dee1951a1ea71 (diff)
downloadqpid-python-199bdab9674606e379654db00913cc27ff702a92.tar.gz
QPID-4924: Fixed the Python examples to use the new Python module
Now the imports will first attempt to bring in qpid_messaging, the Swig generated Python. If that fails it will then fall back to trying to import qpid.messaging, the pure Python binding. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1524572 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/examples/api/hello_xml')
-rwxr-xr-xpython/examples/api/hello_xml18
1 files changed, 11 insertions, 7 deletions
diff --git a/python/examples/api/hello_xml b/python/examples/api/hello_xml
index ab567ec5dd..05fa5cc7ba 100755
--- a/python/examples/api/hello_xml
+++ b/python/examples/api/hello_xml
@@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,11 @@
#
import sys
-from qpid.messaging import *
+
+try:
+ from qpid_messaging import *
+except:
+ from qpid.messaging import *
broker = "localhost:5672"
connection = Connection(broker)
@@ -41,11 +45,11 @@ try:
address = """
xml; {
- create: always,
- node:{ type: queue },
- link: {
+ create: always,
+ node:{ type: queue },
+ link: {
x-bindings: [{ exchange: xml, key: weather, arguments: { xquery: %r} }]
- }
+ }
}
""" % query