Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / amqp / connection.pyc
Size: Mime:
ó
õEYc@@sõdZddlmZmZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZmZmZmZmZmZmZmZddlmZmZmZm Z m!Z!dd
l"m#Z#m$Z$ddl%m&Z&ddl'm(Z(yddl)m*Z*Wn'e+k
rde,fd„ƒYZ*nXdZ-dj.ƒZ/dgZ0ej1dƒZ2idd6e
d6Z3ie4d6e4d6e4d6Z5defd„ƒYZ6dS(uAMQP Connections.i(tabsolute_importtunicode_literalsN(tBytesIO(tensure_promisei(t__version__(tspec(tAbstractChannel(tChannel(tAMQPDeprecationWarningtChannelErrort
ResourceErrortConnectionForcedtConnectionErrorterror_for_codetRecoverableConnectionErrortRecoverableChannelError(tarraytitemst	monotonictrangetvalues(t
frame_handlertframe_writer(t_write_table(t	Transport(tSSLErrorRcB@seZRS((t__name__t
__module__(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR-suüThe .{attr} attribute on the connection was accessed before
the connection was established.  This is supported for now, but will
be deprecated in amqp 2.2.0.

Since amqp 2.0 you have to explicitly call Connection.connect()
before using the connection.
uP
Start from server, version: %d.%d, properties: %s, mechanisms: %s, locales: %s
u
Connectionuamqpupy-amqpuproductuproduct_versionuconsumer_cancel_notifyuconnection.blockeduauthentication_failure_closet
ConnectioncB@sTeZdZeZeZeZd6Z	d6Z
d6ZdZdZ
dZdZd6Zd6ZejejjdƒejejjƒejejjdƒejejjdƒejejjdƒejejjƒejejjƒejejjƒhZd„eDƒZeej e!e"fZ#e$fZ%e&ej e!e"fZ'e(fZ)dddd	d6d
dd6e*d6d6d6dd6d6d6e*d6d6d6d6e+e,d„Z-d
„Z.d„Z/d6d„Z0d„Z1d6d„Z2d„Z3e4d„ƒZ5e5j6d„ƒZ5e4d„ƒZ7e7j6d„ƒZ7e4d„ƒZ,e,j6d„ƒZ,dd„Z8d„Z9dd„Z:dd„Z;d„Z<e*d6d6d6d „Z=e4d!„ƒZ>d"„Z?d#„Z@d$„ZAd6d6d%„ZBd&„ZCd6d'„ZDd6d(„ZEd)„ZFdd*d7dd+„ZGd,„ZHd-„ZId.„ZJd/„ZKd0„ZLd1„ZMd2d3„ZNe4d4„ƒZOe4d5„ƒZPRS(8u#AMQP Connection.

    The connection class provides methods for a client to establish a
    network connection to a server, and for both peers to operate the
    connection thereafter.

    GRAMMAR::

        connection          = open-connection *use-connection close-connection
        open-connection     = C:protocol-header
                              S:START C:START-OK
                              *challenge
                              S:TUNE C:TUNE-OK
                              C:OPEN S:OPEN-OK
        challenge           = S:SECURE C:SECURE-OK
        use-connection      = *channel
        close-connection    = C:CLOSE S:CLOSE-OK
                            / S:CLOSE C:CLOSE-OK
    Create a connection to the specified host, which should be
    a 'host[:port]', such as 'localhost', or '1.2.3.4:5672'
    (defaults to 'localhost', if a port is not specified then
    5672 is used)

    If login_response is not specified, one is built up for you from
    userid and password if they are present.

    The 'ssl' parameter may be simply True/False, or for Python >= 2.6
    a dictionary of options to pass to ssl.wrap_socket() such as
    requiring certain certificates.

    The "socket_settings" parameter is a dictionary defining tcp
    settings which will be applied as socket options.
    iuooFSSusuBlBuBsBBcC@si|]}||j“qS((t
method_sig(t.0tm((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pys
<dictcomp>«s	ulocalhost:5672uguestuAMQPLAINu/uen_UScK@sþtjƒj|_|pd}|p'd}|dkr‹|dk	r‹|dk	r‹tƒ}ti|d6|d6|jgƒ|jƒd}nt	|j
|pi|_||_||_
||_||_||_t|ƒ|_||_||_t|_i|_tt|ƒj|dƒd|_d|_d|_||_||_|
|_ ||_!|	|_"||_#||_$||_%||_&||_'t|ƒ|_(t)dt*|jddƒƒ|_+d|_,d|_-i|_.g|_/g|_0|
|_1dS(	NiÿÿiuLOGINuPASSWORDiiuHiÿÿÿÿ(2tuuidtuuid4thext_connection_idtNoneRRtwritetgetvaluetdicttlibrary_propertiestclient_propertiestlogin_methodtlogin_responsetlocalethosttvirtual_hostRt
on_tune_oktframe_handler_clstframe_writer_clstFalset_handshake_completetchannelstsuperRt__init__t
_frame_writert_on_inbound_framet
_transporttchannel_maxt	frame_maxtclient_heartbeattconfirm_publishtssltread_timeoutt
write_timeouttsocket_settingst
on_blockedton_unblockedton_openRRt_avail_channel_idst
version_majort
version_minortserver_propertiest
mechanismstlocalestconnect_timeout(tselfR-tuseridtpasswordR*R+R.R,R)R>RKR:R;t	heartbeatRDRBRCR=R/R?R@RARRtkwargs((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR6¾sX		
																						!					cC@s|jƒ|S(N(tconnect(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt	__enter__s
cG@s|jƒdS(N(tclose(RLteargs((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt__exit__	scC@s|jj||ƒS(N(RDtthen(RLt
on_successton_error((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRVscC@s”|jji|jtjj6|jtjj6|jtjj	6|j
tjj6|jtjj
6|jtjj6|jtjj6|jtjj6ƒdS(N(t
_callbackstupdatet	_on_startRRtStartt_on_open_oktOpenOkt
_on_securetSecuret_on_tunetTunet	_on_closetCloset_on_blockedtBlockedt
_on_unblockedt	Unblockedt_on_close_oktCloseOk(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt_setup_listenersscC@s´|jr|r|ƒSdS|j|j|j|j|j|jd|jƒ|_	|j	j
ƒ|j||jƒ|_
|j||j	ƒ|_x |js¯|jd|jƒqWdS(NRAttimeout(t	connectedR$RR-RKR>R?R@RAt	transportRQR0ton_inbound_methodton_inbound_frameR1RR3tdrain_events(RLtcallback((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRQs	
cC@s#tjttjd|ƒƒƒdS(Ntattr(twarningstwarnRtW_FORCE_CONNECTtformat(RLRs((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt_warn_force_connect.s	cC@s0|jdkr)|jdƒ|jƒn|jS(Nu	transport(R9R$RxRQ(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRn2s

cC@s
||_dS(N(R9(RLRn((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRn9scC@s0|jdkr)|jdƒ|jƒn|jS(Nuon_inbound_frame(R8R$RxRQ(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRp=s

cC@s
||_dS(N(R8(RLRp((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRpDscC@s0|jdkr)|jdƒ|jƒn|jS(Nuframe_writer(R7R$RxRQ(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRHs

cC@s
||_dS(N(R7(RLR((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyROsuFsSsc	@s|j}||_||_||_|jdƒ|_|jdƒ|_tjt	|j|j|j|j|jƒ|j
dƒp…i‰|jdiƒ}|j‡fd†t
|jƒDƒƒ|sÙ|jddƒn|jtjj|||j|j|jfƒdS(Nu ucapabilitiesc@s.i|]$\}}ˆj|ƒr||“qS((tget(Rt
wanted_capt
enable_cap(tscap(sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pys
<dictcomp>es		(R)RFRGRHtsplitRIRJtAMQP_LOGGERtdebugtSTART_DEBUG_FMTRyt
setdefaultRZRtnegotiate_capabilitiestpopR$tsend_methodRRtStartOkR*R+R,(	RLRFRGRHRIRJtargsigR)tcap((R|sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR[Ss*					cC@sdS(N((RLt	challenge((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR_tscC@s×|jpd}|p|j|_|p-|j|_|p<d|_|jdks]|dkrut|j|ƒ|_nt|j|ƒ|_|jsŸd|_n|jtj	j
||j|j|jfd|jƒdS(NiRr(R<R:R;tserver_heartbeattmaxROtminR„RRtTuneOkt
_on_tune_sent(RLR:R;R‰R†R<((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRaws	ussbcC@s)|jtjj||jdtfƒdS(Nu(R„RRtOpenR.R2(RLR†((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRŽscC@st|_|j|ƒdS(N(tTrueR3RD(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR]“s	c
K@s+t|d|d|d|d|d||S(NRKR>R?R@RA(R(RLR-RKR>R?R@RARP((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR—scC@s|jo|jjS(N(R9Rm(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRmŸscC@s”zuyZ|jjƒgt|jƒD]}||k	r#|^q#}x|D]}|jƒqHWWntjk
rsnXWdd|_|_	|_XdS(N(
RnRSRR4tcollecttsocketterrorR$R9t
connection(RLtxt	temp_listtch((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR£s
.
cC@sVy|jjƒSWn>tk
rQtdjt|jƒ|jƒtj	j
ƒ‚nXdS(Nu1No free channel ids, current={0}, channel_max={1}(RERƒt
IndexErrorR
RwtlenR4R:RRRŽ(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt_get_free_channel_id¯s
cC@s?y|jj|ƒSWn$tk
r:td|fƒ‚nXdS(NuChannel %r already open(REtremovet
ValueErrorR(RLt
channel_id((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt_claim_channel_id·s
cC@sh|jdk	rXy|j|SWqXtk
rT|j||d|ƒ}|jƒ|SXntdƒ‚dS(uCreate new channel.

        Fetch a Channel object identified by the numeric channel_id, or
        create that object if it doesn't already exist.
        RDuConnection already closed.N(R4R$tKeyErrorRtopenR(RLRœRrtchannel((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR ½s

cC@stdƒ‚dS(NuUse AMQP heartbeats(tNotImplementedError(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pytis_aliveÌscC@s
|j|ƒS(N(t
blocking_read(RLRl((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRqÏscC@s5|jj|ƒ|jjƒ}WdQX|j|ƒS(N(Rnthaving_timeoutt
read_frameRp(RLRltframe((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR£ÒscC@s|j|j|||ƒS(N(R4tdispatch_method(RLRœRtpayloadtcontent((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRo×s
ucC@sL|jdkrdS|jtjj||||d|dfdtjjƒS(uˆRequest a connection close.

        This method indicates that the sender wants to close the
        connection. This may be due to internal conditions (e.g. a
        forced shut-down) or due to an error handling a specific
        method, i.e. an exception.  When a close is due to an
        exception, the sender provides the class and method id of the
        method which caused the exception.

        RULE:

            After sending this method any received method except the
            Close-OK method MUST be discarded.

        RULE:

            The peer sending this method MAY use a counter or timeout
            to detect failure of the other peer to respond correctly
            with the Close-OK method.

        RULE:

            When a server receives the Close method from a client it
            MUST delete all server-side resources associated with the
            client's context.  A client CANNOT reconnect to a context
            after sending or receiving a Close method.

        PARAMETERS:
            reply_code: short

                The reply code. The AMQ reply codes are defined in AMQ
                RFC 011.

            reply_text: shortstr

                The localised reply text.  This text can be logged as an
                aid to resolving issues.

            class_id: short

                failing method class

                When the close is provoked by a method exception, this
                is the class of the method.

            method_id: short

                failing method ID

                When the close is provoked by a method exception, this
                is the ID of the method.
        Niitwait(R9R$R„RRRdRj(RLt
reply_codet
reply_textRR†((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRSÜs6cC@s)|jƒt||||ftƒ‚dS(uˆRequest a connection close.

        This method indicates that the sender wants to close the
        connection. This may be due to internal conditions (e.g. a
        forced shut-down) or due to an error handling a specific
        method, i.e. an exception.  When a close is due to an
        exception, the sender provides the class and method id of the
        method which caused the exception.

        RULE:

            After sending this method any received method except the
            Close-OK method MUST be discarded.

        RULE:

            The peer sending this method MAY use a counter or timeout
            to detect failure of the other peer to respond correctly
            with the Close-OK method.

        RULE:

            When a server receives the Close method from a client it
            MUST delete all server-side resources associated with the
            client's context.  A client CANNOT reconnect to a context
            after sending or receiving a Close method.

        PARAMETERS:
            reply_code: short

                The reply code. The AMQ reply codes are defined in AMQ
                RFC 011.

            reply_text: shortstr

                The localised reply text.  This text can be logged as an
                aid to resolving issues.

            class_id: short

                failing method class

                When the close is provoked by a method exception, this
                is the class of the method.

            method_id: short

                failing method ID

                When the close is provoked by a method exception, this
                is the ID of the method.
        N(t_x_close_okR
R(RLR«R¬tclass_idt	method_id((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRcs5
	cC@s |jtjjd|jƒdS(uhConfirm a connection close.

        This method confirms a Connection.Close method and tells the
        recipient that it is safe to release resources for the
        connection and close the socket.

        RULE:
            A peer that detects a socket closure without having
            received a Close-Ok handshake method SHOULD log the error.
        RrN(R„RRRjRi(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR­UscC@s|jƒdS(uiConfirm a connection close.

        This method confirms a Connection.Close method and tells the
        recipient that it is safe to release resources for the
        connection and close the socket.

        RULE:

            A peer that detects a socket closure without having
            received a Close-Ok handshake method SHOULD log the error.
        N(R(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRibscC@s d}|jr|j|ƒSdS(ulCallback called when connection blocked.

        Notes:
            This is an RabbitMQ Extension.
        u#connection blocked, see broker logsN(RB(RLtreason((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyReps	cC@s|jr|jƒSdS(N(RC(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyRgzs	cC@s|jdddddƒdS(Nii(RR$(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pytsend_heartbeat~sicC@sWtjd|jƒ|js dS|j}|j}|jdksP|j|kr_tƒ|_	n|j
dks}|j
|krŒtƒ|_ntƒ}tjd|j|j
||||j	|j|jƒ	|||_|_
||j	|jkrtjd|jƒ|jƒtƒ|_	n|jrS|jd|jtƒkrSt
dƒ‚ndS(ucSend heartbeat packets if necessary.

        Raises:
            ~amqp.exceptions.ConnectionForvced: if none have been
                received recently.

        Note:
            This should be called frequently, on the order of
            once per second.

        Keyword Arguments:
            rate (int): Previously used, but ignored now.
        u"heartbeat_tick : for connection %sNu„heartbeat_tick : Prev sent/recv: %s/%s, now - %s/%s, monotonic - %s, last_heartbeat_sent - %s, heartbeat int. - %s for connection %su3heartbeat_tick: sending heartbeat for connection %siuToo many heartbeats missed(R~RR#ROt
bytes_sentt
bytes_recvt	prev_sentR$Rtlast_heartbeat_sentt	prev_recvtlast_heartbeat_receivedR±R(RLtratetsent_nowtrecv_nowtnow((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pytheartbeat_ticks:	
					


		cC@s
|jjS(N(Rntsock(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyR½ºscC@s|jjdƒpiS(Nucapabilities(RHRy(RL((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pytserver_capabilities¾sN(ii(QRRt__doc__RtNEGOTIATE_CAPABILITIESR‚tLIBRARY_PROPERTIESR(R$ROR<R‰RµR·R²R³R´R¶RtmethodRR\R^R`RbRdRfRhRjt_METHODSRR‘R’tIOErrortOSErrortconnection_errorsR	tchannel_errorsRtrecoverable_connection_errorsRtrecoverable_channel_errorsR2RRR6RRRURVRkRQRxtpropertyRntsetterRpR[R_RaRR]RRmRR™RR R¢RqR£RoRSRcR­RiReRgR±R¼R½R¾(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyROs !								?				 									?	9	
		
		9(7R¿t
__future__RRtloggingR‘R RttioRtvineRtRRtabstract_channelRR Rt
exceptionsRR	R
RRR
RRtfiveRRRRRtmethod_framingRRt
serializationRRnRR>RtImportErrort	ExceptionRvtstripR€t__all__t	getLoggerR~RÁRRÀR(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/amqp/connection.pyt<module>s@:(