Your IP : 3.135.241.191
B
��Yz � @ s� d Z ddlmZ ddlmZ ddlmZ yBddlZyddlm Z W n e
k
rb ddlm Z Y nX dZW n e
k
r� dZY nX G dd � d ee�Z
dS )
z�
raven.transport.gevent
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
� )�absolute_import)�AsyncTransport)�
HTTPTransportN)� SemaphoreTc s: e Zd ZddgZd
� fdd� Z� fdd�Zdd � Z� ZS )�GeventedHTTPTransportzgevent+httpzgevent+https�d c s, t std��t|�| _tt| �j||� d S )Nz&GeventedHTTPTransport requires gevent.)�
has_gevent�ImportErrorr �_lock�superr �__init__)�selfZmaximum_outstanding_requests�args�kwargs)� __class__� �G/opt/alt/python37/lib/python3.7/site-packages/raven/transport/gevent.pyr s
zGeventedHTTPTransport.__init__c s4 �j �� t�tt��j|||��� ��fdd��S )z?
Spawn an async request to a remote webserver.
c s �� | �� �S )N)�_done)�x)�
failure_cbr
�
success_cbr r �<lambda>. � z2GeventedHTTPTransport.async_send.<locals>.<lambda>)r
�acquire�gevent�spawnr r �send�link)r
�url�data�headersr r )r )r r
r r �
async_send% s
z GeventedHTTPTransport.async_sendc G s( | j �� |�� r|� n
||j� d S )N)r
�releaseZ
successful� exception)r
Zgreenletr r r r r r r 0 s
zGeventedHTTPTransport._done)r )�__name__�
__module__�__qualname__�schemer r! r �
__classcell__r r )r r r s r )�__doc__�
__future__r Zraven.transport.baser Zraven.transport.httpr r Zgevent.lockr r Zgevent.corosr r r r r r �<module> s