Package proton
[frames] | no frames]

Source Code for Package proton

  1  # 
  2  # Licensed to the Apache Software Foundation (ASF) under one 
  3  # or more contributor license agreements.  See the NOTICE file 
  4  # distributed with this work for additional information 
  5  # regarding copyright ownership.  The ASF licenses this file 
  6  # to you under the Apache License, Version 2.0 (the 
  7  # "License"); you may not use this file except in compliance 
  8  # with the License.  You may obtain a copy of the License at 
  9  # 
 10  #   http://www.apache.org/licenses/LICENSE-2.0 
 11  # 
 12  # Unless required by applicable law or agreed to in writing, 
 13  # software distributed under the License is distributed on an 
 14  # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
 15  # KIND, either express or implied.  See the License for the 
 16  # specific language governing permissions and limitations 
 17  # under the License. 
 18  # 
 19   
 20  """ 
 21  The proton module defines a suite of APIs that implement the AMQP 1.0 
 22  protocol. 
 23   
 24  The proton APIs consist of the following classes: 
 25   
 26   - L{Message}   -- A class for creating and/or accessing AMQP message content. 
 27   - L{Data}      -- A class for creating and/or accessing arbitrary AMQP encoded 
 28                    data. 
 29   
 30  """ 
 31  from __future__ import absolute_import 
 32   
 33  import logging 
 34  import logging.config 
 35  import os 
 36   
 37  from cproton import PN_VERSION_MAJOR, PN_VERSION_MINOR, PN_VERSION_POINT 
 38   
 39  from ._condition import Condition 
 40  from ._data import UNDESCRIBED, Array, Data, Described, char, symbol, timestamp, ubyte, ushort, uint, ulong, \ 
 41      byte, short, int32, float32, decimal32, decimal64, decimal128 
 42  from ._delivery import Delivery, Disposition 
 43  from ._endpoints import Endpoint, Connection, Session, Link, Receiver, Sender, Terminus 
 44  from ._events import Collector, Event, EventType, Handler 
 45  from ._exceptions import ProtonException, MessageException, DataException, TransportException, \ 
 46      SSLException, SSLUnavailable, ConnectionException, SessionException, LinkException, Timeout, Interrupt 
 47  from ._message import Message 
 48  from ._transport import Transport, SASL, SSL, SSLDomain, SSLSessionDetails 
 49  from ._url import Url 
 50   
 51  __all__ = [ 
 52      "API_LANGUAGE", 
 53      "IMPLEMENTATION_LANGUAGE", 
 54      "UNDESCRIBED", 
 55      "Array", 
 56      "Collector", 
 57      "Condition", 
 58      "Connection", 
 59      "ConnectionException", 
 60      "Data", 
 61      "DataException", 
 62      "Delivery", 
 63      "Disposition", 
 64      "Described", 
 65      "Endpoint", 
 66      "Event", 
 67      "EventType", 
 68      "Handler", 
 69      "Link", 
 70      "LinkException", 
 71      "Message", 
 72      "MessageException", 
 73      "ProtonException", 
 74      "VERSION_MAJOR", 
 75      "VERSION_MINOR", 
 76      "Receiver", 
 77      "SASL", 
 78      "Sender", 
 79      "Session", 
 80      "SessionException", 
 81      "SSL", 
 82      "SSLDomain", 
 83      "SSLSessionDetails", 
 84      "SSLUnavailable", 
 85      "SSLException", 
 86      "Terminus", 
 87      "Timeout", 
 88      "Interrupt", 
 89      "Transport", 
 90      "TransportException", 
 91      "Url", 
 92      "char", 
 93      "symbol", 
 94      "timestamp", 
 95      "ulong", 
 96      "byte", 
 97      "short", 
 98      "int32", 
 99      "ubyte", 
100      "ushort", 
101      "uint", 
102      "float32", 
103      "decimal32", 
104      "decimal64", 
105      "decimal128" 
106  ] 
107   
108  VERSION_MAJOR = PN_VERSION_MAJOR 
109  VERSION_MINOR = PN_VERSION_MINOR 
110  VERSION_POINT = PN_VERSION_POINT 
111  VERSION = (VERSION_MAJOR, VERSION_MINOR, VERSION_POINT) 
112  API_LANGUAGE = "C" 
113  IMPLEMENTATION_LANGUAGE = "C" 
114   
115   
116  # This private NullHandler is required for Python 2.6, 
117  # when we no longer support 2.6 replace this NullHandler class definition and assignment with: 
118  #  handler = logging.NullHandler() 
119 -class NullHandler(logging.Handler):
120 - def handle(self, record):
121 pass
122
123 - def emit(self, record):
124 pass
125
126 - def createLock(self):
127 self.lock = None
128 129 130 handler = NullHandler() 131 132 logconfigfile = os.getenv('PNPY_LOGGER_CONFIG', None) 133 if logconfigfile: 134 logging.config.fileConfig(logconfigfile, None, False) 135 else: 136 log = logging.getLogger("proton") 137 log.addHandler(handler) 138