<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
ó
¿öYc           @@  sœ   d  Z  d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m	 Z	 d d l
 m Z e j d ƒ Z d „  Z d	 e	 f d
 „  ƒ  YZ d S(   sÐ   
raven.contrib.awslambda
~~~~~~~~~~~~~~~~~~~~

Raven wrapper for AWS Lambda handlers.

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
i    (   t   absolute_importN(   t   FunctionType(   t   Client(   t   HTTPTransports   sentry.errors.clientc           C@  s.   i d d 6d d 6d d 6d d 6d	 d
 6d d 6S(   Nt   AWS_LAMBDA_FUNCTION_NAMEt   lambdat   AWS_LAMBDA_FUNCTION_VERSIONt   versiont   AWS_LAMBDA_FUNCTION_MEMORY_SIZEt   memory_sizet   AWS_LAMBDA_LOG_GROUP_NAMEt	   log_groupt   AWS_LAMBDA_LOG_STREAM_NAMEt
   log_streamt
   AWS_REGIONt   region(    (    (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyt   get_default_tags   s    t   LambdaClientc           B@  se   e  Z d  Z d „  Z d „  Z d „  Z d d d „ Z e d „  ƒ Z	 e d „  ƒ Z
 e d „  ƒ Z RS(	   s™  
    Raven decorator for AWS Lambda.

    By default, the lambda integration will capture unhandled exceptions and instrument logging.

    Usage:

    >>> from raven.contrib.awslambda import LambdaClient
    >>>
    >>>
    >>> client = LambdaClient()
    >>>
    >>> @client.capture_exceptions
    >>> def handler(event, context):
    >>>    ...
    >>>    raise Exception('I will be sent to sentry!')

    c         O@  s5   | j  d t ƒ } t t |  ƒ j d | | | Ž d  S(   Nt	   transport(   t   getR   t   superR   t   __init__(   t   selft   argst   kwargsR   (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR   8   s    c         O@  sÍ   d | k r i  | d <} n
 | d } | j  d d  ƒ } | j  d d  ƒ } |  j | ƒ } | rp | j | ƒ n  | r´ |  j | ƒ } | r› | j | ƒ n  |  j | | ƒ | d <n  t t |  ƒ j | | Ž  S(   Nt   datat   eventt   contextt   extra(	   R   t   Nonet   _get_user_interfacet   updatet   _get_http_interfacet   _get_extra_dataR   R   t   capture(   R   R   R   R   R   R   t	   user_infot	   http_info(    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR"   <   s    
c         O@  s—   t  t |  ƒ j | | Ž  } x= t ƒ  j ƒ  D], \ } } | d j | t j j | ƒ ƒ q+ W| j d t j j d ƒ ƒ | j d t j j d ƒ ƒ | S(   Nt   tagst   releaset   SENTRY_RELEASEt   environmentt   SENTRY_ENVIRONMENT(	   R   R   t	   build_msgR   t   itemst
   setdefaultt   ost   environR   (   R   R   R   R   t   optiont   default(    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR*   M   s    $c         @  s\   t  ˆ t ƒ s% t j ˆ j d ˆ ƒSˆ  p1 t f ‰  t j ˆ ƒ ‡  ‡ ‡ f d †  ƒ } | S(   sˆ  
        Wrap a function or code block in try/except and automatically call
        ``.captureException`` if it raises an exception, then the exception
        is reraised.

        By default, it will capture ``Exception``

        >>> @client.capture_exceptions
        >>> def foo():
        >>>     raise Exception()

        >>> with client.capture_exceptions():
        >>>    raise Exception()

        You can also specify exceptions to be caught specifically

        >>> @client.capture_exceptions((IOError, LookupError))
        >>> def bar():
        >>>     ...

        ``kwargs`` are passed through to ``.captureException``.
        t
   exceptionsc         @  sX   y ˆ |  | | | Ž SWn: ˆ  k
 rS ˆ j  d |  d | |  ˆ j j ƒ  ‚  n Xd  S(   NR   R   (   t   captureExceptionR   t   clear(   R   R   R   R   (   R1   t   fR   (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyt   wrappedt   s    (   t
   isinstanceR   t	   functoolst   partialt   capture_exceptionst	   Exceptiont   wraps(   R   R4   R1   R5   (    (   R1   R4   R   sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR9   V   s
    $c         C@  s¼   |  j  d ƒ r¸ |  d d } | r¸ i | j  d d  ƒ pG | j  d d  ƒ d 6| j  d d  ƒ d 6| j  d d  ƒ d 6| j  d	 d  ƒ d
 6| j  d d  ƒ d 6| j  d ƒ d 6} i | d 6Sn  d  S(   Nt   requestContextt   identityt   cognitoIdentityIdt   usert   idt   usernamet   sourceIpt
   ip_addresst   cognitoIdentityPoolIdt   cognito_identity_pool_idt   cognitoAuthenticationTypet   cognito_authentication_typet	   userAgentt
   user_agent(   R   R   (   R   R=   R?   (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR   ~   s    %c         C@  s   |  j  d ƒ r{ |  j  d ƒ r{ i |  j  d ƒ d 6|  j  d ƒ d 6|  j  d d  ƒ d 6|  j  d d  ƒ pi g  d 6} i | d 6Sd  S(	   Nt   patht
   httpMethodt   urlt   methodt   queryStringParameterst   query_stringt   headerst   request(   R   R   (   R   RQ   (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR       s    c         C@  s¨   i |  d 6| j  d 6t | ƒ d 6} | j r¤ i | j j j d 6| j j j d 6| j j j d 6| j j j d 6| j j j d 6| j j	 d	 6| j j
 d
 6| d <n  | S(   NR   t   aws_request_idR   s   client.installation_ids   client.app_titles   client.app_version_names   client.app_version_codes   client.app_package_namet   customt   envt   client_context(   RR   t   varsRU   t   clientt   installation_idt	   app_titlet   app_version_namet   app_version_codet   app_package_nameRS   RT   (   R   R   t   extra_context(    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR!   ˜   s    
	N(   t   __name__t
   __module__t   __doc__R   R"   R*   R   R9   t   staticmethodR   R    R!   (    (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyR   $   s   				((   R`   t
   __future__R    R-   t   loggingR7   t   typesR   t
   raven.baseR   t   raven.transport.httpR   t	   getLoggert   loggerR   R   (    (    (    sQ   /opt/alt/python27/lib/python2.7/site-packages/raven/contrib/awslambda/__init__.pyt   <module>	   s   	