
    dhE                     R    S r SSKJrJrJr  SSKJr  SSKJrJ	r	J
r
   " S S\5      rg)zUtil that calls Twilio.    )AnyDictOptional)get_from_dict_or_env)	BaseModel
ConfigDictmodel_validatorc                       \ rS rSr% SrSr\\S'   Sr\	\
   \S'    Sr\	\
   \S'    Sr\	\
   \S'    \" SS	S
9r\" SS9\S\S\4S j5       5       rS\
S\
S\
4S jrSrg)TwilioAPIWrapper	   aW  Messaging Client using Twilio.

To use, you should have the ``twilio`` python package installed,
and the environment variables ``TWILIO_ACCOUNT_SID``, ``TWILIO_AUTH_TOKEN``, and
``TWILIO_FROM_NUMBER``, or pass `account_sid`, `auth_token`, and `from_number` as
named parameters to the constructor.

Example:
    .. code-block:: python

        from langchain_community.utilities.twilio import TwilioAPIWrapper
        twilio = TwilioAPIWrapper(
            account_sid="ACxxx",
            auth_token="xxx",
            from_number="+10123456789"
        )
        twilio.run('test', '+12484345508')
Nclientaccount_sid
auth_tokenfrom_numberFforbid)arbitrary_types_allowedextrabefore)modevaluesreturnc                      SSK Jn  [        USS5      n[        USS5      n[        USS	5      US'   U" X45      US
'   U$ ! [         a    [        S5      ef = f)z?Validate that api key and python package exists in environment.r   )ClientzTCould not import twilio python package. Please install it with `pip install twilio`.r   TWILIO_ACCOUNT_SIDr   TWILIO_AUTH_TOKENr   TWILIO_FROM_NUMBERr   )twilio.restr   ImportErrorr   )clsr   r   r   r   s        \/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/utilities/twilio.pyvalidate_environment%TwilioAPIWrapper.validate_environment3   sz    	* +6=BVW)&,@ST
 4M#7!
} "+:x  	? 	s	   ? Abodytoc                 v    U R                   R                  R                  X R                  US9nUR                  $ )a  Run body through Twilio and respond with message sid.

Args:
    body: The text of the message you want to send. Can be up to 1,600
        characters in length.
    to: The destination phone number in
        [E.164](https://www.twilio.com/docs/glossary/what-e164) format for
        SMS/MMS or
        [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses)
        for other 3rd-party channels.
)from_r#   )r   messagescreater   sid)selfr#   r$   messages       r    runTwilioAPIWrapper.runF   s3     ++&&--b8H8Ht-T{{     )__name__
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   strr   r   r   model_configr	   classmethodr   r!   r,   __static_attributes__r/   r.   r    r   r   	   s    & FC!%K#%+ $J$!%K#%	  %L
 (#$ 3   $"   r.   r   N)r4   typingr   r   r   langchain_core.utilsr   pydanticr   r   r	   r   r/   r.   r    <module>r=      s%     & & 5 ; ;Jy Jr.   