Current File : //proc/self/root/lib/python3.12/__pycache__/nntplib.cpython-312.pyc
�

�(�g���
�dZddlZddlZddlZddlZddlZddlZ	ddlZdZddl
mZddlm
Z
gd�Zejed�	�d
ZGd�de�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZdZdZhd�Zgd�Zddd�ZdZej>dgd ��Z ej>d!gd"��Z!d#�Zd$�Z"dWd%�Z#dWd&�Z$dXd'�Z%erd(�Z&Gd)�d*�Z'erGd+�d,e'�Z(ejSd,�ed-k(�r�ddl*Z*e*jVd.�/�Z,e,j[d0d1d2d3�4�e,j[d5d6d7d8�4�e,j[d9d:d;e.d<e�d=e�d>��?�e,j[d@dAdBe.dC�?�e,j[dDdEdFddG�H�e,j_�Z0e0jbZ1e0jse1d;k(reZ1e'e0jde1�I�Z3ne1d;k(reZ1e(e0jde1�I�Z3e3ji�Z5dJe5vre3jm�e3joe0jn�\Z8Z9Z:Z;Z<e=dKe<dLe9dMe:dNe;�dO�Z>e?e.e;�e0j�z
dPz�Z:e3j�e:e;�\Z8ZBeBD]a\ZCZDeeDdQ�j�dRdP�dZFeeDdS�ZGe.eDd�ZHe=dTj�eCe>eFdU�e>eGdV�eH���ce3j��yy#e	$rdZY���wxYw)Ya�An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)

Example:

>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group', name, 'has', count, 'articles, range', first, 'to', last)
Group comp.lang.python has 51 articles, range 5770 to 5821
>>> resp, subs = s.xhdr('subject', '{0}-{1}'.format(first, last))
>>> resp = s.quit()
>>>

Here 'resp' is the server response line.
Error responses are turned into exceptions.

To post an article from a file:
>>> f = open(filename, 'rb') # file containing article, including header
>>> resp = s.post(f)
>>>

For descriptions of all methods, read the comments in the code below.
Note that all arguments and return values representing article numbers
are strings, not numbers, since they are rarely used for calculations.
�NTF)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT)�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorr)��
)�removeic��eZdZdZd�Zy)rz%Base class for all nntplib exceptionsc�r�tj|g|���	|d|_y#t$r
d|_YywxYw)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�argss  �/usr/lib/python3.12/nntplib.pyrzNNTPError.__init__es;�����4�'�$�'�	0� ��G�D�M���	0�/�D�M�	0�s�
#�6�6N)�__name__�
__module__�__qualname__�__doc__r��rrrcs
��/�0rrc��eZdZdZy)rzUnexpected [123]xx replyN�rrrrrrrrrls��"�rrc��eZdZdZy)rz
4xx errorsNrrrrrrp����rrc��eZdZdZy)r	z
5xx errorsNrrrrr	r	tr!rr	c��eZdZdZy)r
z"Response does not begin with [1-5]Nrrrrr
r
xs��,�rr
c��eZdZdZy)rzError in response dataNrrrrrr|s�� �rr�wi3>�100�101�211�215�220�221�222�224�225�230�231�282)�subject�from�datez
message-id�
references�:bytes�:linesr6r7)�bytes�lines�
�	GroupInfo)�group�last�first�flag�ArticleInfo)�number�
message_idr9c���g}t|�D]K\}}t|t�r%|j|j	|xsd���;|j|��Mdj|�S)zvTakes a unicode string representing a munged header value
    and decodes it as a (possibly non-ASCII) readable value.�ascii�)�_email_decode_header�
isinstancer8�append�decode�join)�
header_str�parts�v�encs    rrr�s_��
�E�&�z�2����3��a����L�L����#�.��1�2��L�L��O�	�
�7�7�5�>�rc��g}|D]t}|ddk(r|ddjd�\}}}d|z}n|jd�\}}}|j�}tj||�}|j	|��vt
}t
|�t
|�krtd��|dt
|�|k7rtd��|S)z�Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4).r�:�Nz$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getrH�_DEFAULT_OVERVIEW_FMT�lenr)r9�fmt�line�name�_�suffix�defaultss       r�_parse_overview_fmtr^�s���

�C������7�c�>�"�1�2�h�0�0��5�O�D�!�V���:�D�#�n�n�S�1�O�D�!�V��z�z�|��)�-�-�d�D�9���
�
�4���%�H�
�3�x�#�h�-���B�C�C�
�>�C��M��h�&��H�I�I��Jrc��tt�}g}|D]�}i}|jd�^}}t|�}t	|�D]|\}	}
|	t|�k\r�||	}|jd�}|	|k\rE|sC|dz}
|
r*|
dt|
�j
�|
k7rtd��|
r|
t|
�dnd}
|
|||	<�~|j||f���|S)zZParse the response to an OVER or XOVER command according to the
    overview format `fmt`.�	rPz: Nz?OVER/XOVER response doesn't include names of additional headers)	rWrV�split�int�	enumerate�
startswithrSrrH)r9rX�data_process_func�
n_defaults�overviewrY�fields�article_number�tokens�i�token�
field_name�is_metadata�hs              r�_parse_overviewrp�s���*�+�J��H��2����"&�*�*�T�"2�����^�,��!�&�)�	#�H�A�u��C��H�}���Q��J�$�/�/��4�K��J��{���%���U�7�C��F�^�1�1�3�q�8�'�)F�G�G�*/��c�!�f�g��T��"�F�3�q�6�N�!	#�"	�����0�1�+2�,�Orc� �|�
|dd}|dd}t|dd�}t|dd�}t|dd�}t|dd�}t|dd�}t|dd�}|dkr|dz
}n
|d	kr|d
z
}tj||||||�S)z�Parse a pair of (date, time) strings, and return a datetime object.
    If only the date is given, it is assumed to be date and time
    concatenated together (e.g. response to the DATE command).
    Ni�������������Fi��dil)rb�datetime)�date_str�time_str�hours�minutes�seconds�year�month�days        r�_parse_datetimer��s���
���B�C�=���C�R�=�����!���E��(�1�Q�-� �G��(�1�2�,��G��x���}��D����B�� �E�

�h�r�s�m�
�C��b�y�����	
����������T�5�#�u�g�w�G�Grc���t|tj�sd}ndj|�}|j}|r|dz}dj||�}||fSdj||�}||fS)aPFormat a date or datetime object as a pair of (date, time) strings
    in the format required by the NEWNEWS and NEWGROUPS commands.  If a
    date object is passed, the time is assumed to be midnight (00h00).

    The returned representation depends on the legacy flag:
    * if legacy is False (the default):
      date has the YYYYMMDD format and time the HHMMSS format
    * if legacy is True:
      date has the YYMMDD format and time the HHMMSS format.
    RFC 3977 compliant servers should understand both formats; therefore,
    legacy is only needed when talking to old servers.
    �000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rwz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})rGrx�formatr~)�dt�legacyrz�yrys     r�_unparse_datetimer�s|���b�(�+�+�,���=�D�D�R�H��
���A�
�
��G��4�;�;�A�r�B���X���5�;�;�A�r�B���X��rc�T�|�tj�}|j||��S)z�Wrap a socket in SSL/TLS. Arguments:
        - sock: Socket to wrap
        - context: SSL context to use for the encrypted connection
        Returns:
        - sock: New, encrypted socket.
        )�server_hostname)�ssl�_create_stdlib_context�wrap_socket)�sock�context�hostnames   r�_encrypt_onr�s-���?��0�0�2�G��"�"�4��"�B�Brc��eZdZdZdZeddddefd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZeZd
�Zd�Zd7d�Zd�Zd8d�Zd�Zd8d�Zd8d�Zd�Zd�Zd�Zdd�d�Zdd�d�Zd8dd�d�Zd�Zd�Zd�Z d�Z!dd�d �Z"d!�Z#d"�Z$d8d#�Z%d$�Z&d%�Z'd8d&�Z(d8dd�d'�Z)d8dd�d(�Z*d8dd�d)�Z+d*�Z,dd�d+�Z-dd�d,�Z.dd�d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d9d4�Z6d5�Z7e8rd8d6�Z9yy):rzutf-8�surrogateescapeNFc�z�||_||_|j|�|_d|_	|jjd�|_|j
|�|s|r|j|||�yy#|jr|jj�|jj��xYw)a,Initialize an instance.  Arguments:
        - host: hostname to connect to
        - port: port to connect to (default the standard NNTP port)
        - user: username to authenticate with
        - password: password to use with username
        - readermode: if true, send 'mode reader' command after
                      connecting.
        - usenetrc: allow loading username and password from ~/.netrc file
                    if not specified explicitly
        - timeout: timeout (in seconds) used for socket connections

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific commands, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        N�rwb)	�host�port�_create_socketr��file�makefile�
_base_init�login�close)rr�r��user�password�
readermode�usenetrc�timeouts        rrz
NNTP.__init__;s���(��	���	��'�'��0��	���	�		��	�	�*�*�5�1�D�I��O�O�J�'��x��
�
�4��8�4� ��	��y�y��	�	���!��I�I�O�O���s
�AA7�7AB:c��d|_|j�|_d|_|j	�d|_|rAd|jvr3|j
�|j
sd|_|j	�d|_d|_y)z~Partial initialization for the NNTP protocol.
        This instance method is extracted for supporting the test code.
        rNF�READER)	�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr�s  rr�zNNTP._base_init^s�������}�}������
�����%*��!��(�$�*�*�4����!��,�,�!��
��$�$�&�
���#��rc��|S�Nr�rs r�	__enter__zNNTP.__enter__�s���rc�����fd�}|�r*	�j�|�r�j�yyy#ttf$rY�+wxYw#|�r�j�wwxYw)Nc���t�d�S)Nr�)�hasattrr�s�r�<lambda>zNNTP.__exit__.<locals>.<lambda>�s���w�t�V�4�r)�quit�OSError�EOFError�_close)rr�is_connecteds`  r�__exit__z
NNTP.__exit__�sd���4���>�
"��	�	�� �>��K�K�M�"�
���X�&�
��
�� �>��K�K�M�"�s!�9�A�A�
A�A�A(c���|�
|std��tjd||j|j�tj|j|jf|�S)Nz0Non-blocking socket (timeout=0) is not supportedznntplib.connect)�
ValueError�sys�auditr�r��socket�create_connection)rr�s  rr�zNNTP._create_socket�sQ����w��O�P�P��	�	�#�T�4�9�9�d�i�i�@��'�'����D�I�I�(>��H�Hrc�p�|jrtdt|j��|jS)z�Get the welcome message from the server
        (this is read and squirreled away by __init__()).
        If the response code is 200, posting is allowed;
        if it 201, posting is not allowed.z	*welcome*)r��print�reprr�r�s r�
getwelcomezNNTP.getwelcome�s'���>�>�5��d�4�<�<�.@�A��|�|�rc�n�|j�wd|_d|_	|j�\}}||_d|vr!t	tt|d��|_d|vrdj|d�|_|jS|jS#ttf$ri|_Y|jSwxYw)z�Get the server capabilities, as read by __init__().
        If the CAPABILITIES command is not supported, an empty dict is
        returned.NrQ�VERSION�IMPLEMENTATION� )
r��nntp_version�nntp_implementation�capabilities�max�maprbrJr	r)r�resp�capss   rr�zNNTP.getcapabilities�s����:�:�� !�D��'+�D�$�
P�!�.�.�0�
��d�
"��
���$�),�C��T�)�_�,E�(F�D�%�#�t�+�/2�x�x��=M�8N�/O�D�,��z�z��t�z�z���'�(:�;�
 ���
��z�z��
 �s�B�B4�3B4c��||_y)z�Set the debugging level.  Argument 'level' means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r�)r�levels  r�set_debuglevelzNNTP.set_debuglevel�s����rc��tjd||�|tz}|jdkDrt	dt|��|jj|�|jj�y)zfInternal: send one line to the server, appending CRLF.
        The `line` must be a bytes-like object.znntplib.putlinerQz*put*N)	r�r��_CRLFr�r�r�r��write�flush�rrYs  r�_putlinez
NNTP._putline�sU��	�	�	�#�T�4�0��e�|���>�>�A��u�W�d�4�j�9��	�	������	�	���rc��|jrtdt|��|j|j|j
�}|j
|�y)zkInternal: send one command to the server (through _putline()).
        The `line` must be a unicode string.z*cmd*N)r�r�r��encode�encoding�errorsr�r�s  r�_putcmdzNNTP._putcmd�s<���>�>�5��$�t�*�5��{�{�4�=�=�$�+�+�6���
�
�d�rc�&�|jjtdz�}t|�tkDrt	d��|j
dkDrt
dt|��|st�|r#|ddtk(r|dd}|S|ddtvr|dd}|S)z�Internal: return one line from the server, stripping _CRLF.
        Raise EOFError if the connection is closed.
        Returns a bytes object.rQz
line too longz*get*ruN���)
r��readline�_MAXLINErWrr�r�r�r�r�)r�
strip_crlfrYs   r�_getlinez
NNTP._getline�s����y�y�!�!�(�A�+�.���t�9�x����0�0��>�>�A���'�4��:�&��8�^���B�C�y�E�!��C�R�y�����b�c��e�#��C�R�y���rc��|j�}|jrtdt|��|j	|j
|j�}|dd}|dk(rt|��|dk(rt|��|dvrt|��|S)z�Internal: get a response from the server.
        Raise various errors if the response indicates an error.
        Returns a unicode string.z*resp*NrQ�4�5�123)
r�r�r�r�rIr�r�rr	r
)rr��cs   rr�z
NNTP._getresp�s����}�}����>�>�5��4��:�6��{�{�4�=�=�$�+�+�6����!�H����8�$�T�*�*���8�$�T�*�*��E�>�#�D�)�)��rc��d}	t|ttf�rt|d�x}}|j	�}|ddt
vrt
|��g}|�Jdtzdf}	|jd�}||vrni|jd�r|dd}|j|��>d}	|j�}||k(rn(|jd�r|dd}|j|��>|r|j�||fS#|r|j�wwxYw)	aPInternal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.

        Returns a (response, lines) tuple where `response` is a unicode
        string and `lines` is a list of bytes objects.
        If `file` is a file-like object, it must be open in binary mode.
        N�wbr�.s.
rQFs..)
rG�strr8�openr��	_LONGRESPrr�r�rdr�rHr�)rr��
openedFiler�r9�terminatorsrY�
terminators        r�_getlongrespzNNTP._getlongresp�s)���
� 	#��$��e��-�$(��t�$4�4�
�T��=�=�?�D��B�Q�x�y�(�$�T�*�*��E���#�e�|�V�4����=�=��/�D��{�*�����u�-�#�A�B�x���J�J�t�$�
�"�
���=�=�?�D��z�)�����u�-�#�A�B�x���L�L��&�
��� � �"��U�{����� � �"��s�CC3�3Dc�D�|j|�|j�S)zWInternal: send a command and get the response.
        Same return value as _getresp().)r�r�r�s  r�	_shortcmdzNNTP._shortcmds��	
���T���}�}��rc�F�|j|�|j|�S)zoInternal: send a command and get the response plus following text.
        Same return value as _getlongresp().)r�r�)rrYr�s   r�_longcmdz
NNTP._longcmd!s!��	
���T��� � ��&�&rc���|j|�|j|�\}}||D�cgc](}|j|j|j���*c}fScc}w)z�Internal: send a command and get the response plus following text.
        Same as _longcmd() and _getlongresp(), except that the returned `lines`
        are unicode strings rather than bytes objects.
        )r�r�rIr�r�)rrYr�r��lists     r�_longcmdstringzNNTP._longcmdstring's_��
	
���T���&�&�t�,�
��d��"&�(���k�k�$�-�-����=�(�(�	(��(s�-Ac��	|jS#t$rYnwxYw	|jd�\}}t|�}n#t$rt
dd}YnwxYw||_|S)zqInternal: get the overview format. Queries the server if not
        already done, else returns the cached value.zLIST OVERVIEW.FMTN)�_cachedoverviewfmt�AttributeErrorr�r^r	rV)rr�r9rXs    r�_getoverviewfmtzNNTP._getoverviewfmt1su��	��*�*�*���	��	��	-��-�-�.A�B�K�D�%�
&�e�,�C��	"�	+�'��*�C�	+��
#&����
s��	��>�A�Ac�T�|D�cgc]}t|j����c}Scc}wr�)r;ra)rr9rYs   r�
_grouplistzNNTP._grouplistBs!��5:�;�T�	�4�:�:�<�(�;�;��;s�%c�r�i}|jd�\}}|D]}|j�^}}|||<�||fS)a!Process a CAPABILITIES command.  Not supported by all servers.
        Return:
        - resp: server response if successful
        - caps: a dictionary mapping capability names to lists of tokens
        (for example {'VERSION': ['2'], 'OVER': [], LIST: ['ACTIVE', 'HEADERS'] })
        �CAPABILITIES)r�ra)rr�r�r9rYrZrjs       rr�zNNTP.capabilitiesFsP�����)�)�.�9���e��	 �D� �J�J�L�M�D�6��D��J�	 ��T�z�r)r�c�^�t|tjtjf�s.tdj	|j
j���t||jdk�\}}dj	||�}|j||�\}}||j|�fS)z�Process a NEWGROUPS command.  Arguments:
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of newsgroup names
        �Athe date parameter must be a date or datetime object, not '{:40}'rrzNEWGROUPS {0} {1})rGrxr4�	TypeErrorr��	__class__rr�r�r�r)rr4r�ryrz�cmdr�r9s        r�	newgroupszNNTP.newgroupsTs����$�����
�
� >�?���$�f�T�^�^�%<�%<�=�?�
?�/�t�T�5F�5F��5J�K���(�!�(�(��8�<���)�)�#�t�4���e��T�_�_�U�+�+�+rc�4�t|tjtjf�s.tdj	|j
j���t||jdk�\}}dj	|||�}|j||�S)z�Process a NEWNEWS command.  Arguments:
        - group: group name or '*'
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of message ids
        rrrzNEWNEWS {0} {1} {2})
rGrxr4rr�rrr�r�r�)rr<r4r�ryrzrs       r�newnewszNNTP.newnewsds����$�����
�
� >�?���$�f�T�^�^�%<�%<�=�?�
?�/�t�T�5F�5F��5J�K���(�#�*�*�5�(�H�E���"�"�3��-�-rc�f�|�d|z}nd}|j||�\}}||j|�fS)a@Process a LIST or LIST ACTIVE command. Arguments:
        - group_pattern: a pattern indicating which groups to query
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (group, last, first, flag) (strings)
        zLIST ACTIVE �LIST)r�r)r�
group_patternr��commandr�r9s      rr�z	NNTP.listtsC���$�$�}�4�G��G��)�)�'�4�8���e��T�_�_�U�+�+�+rc�N�tjd�}|jd|z�\}}|jd�s|jd|z�\}}i}|D]D}|j	|j��}|s�%|j
dd�\}	}
|s|
cS|
||	<�F|r||fSy)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS r)zXGTITLE rQrrrE)�re�compiler�rd�search�stripr<)rr
�
return_all�line_patr�r9�groups�raw_line�matchrZ�descs           r�_getdescriptionszNNTP._getdescriptions�s����:�:�>�?���)�)�*<�}�*L�M���e����u�%��-�-�j�=�.H�I�K�D�%����	$�H��O�O�H�N�N�$4�5�E��"�[�[��A�.�
��d�!��K�#��t��
	$����<��rc�&�|j|d�S)a�Get a description for a single group.  If more than one
        group matches ('group' is a pattern), return the first.  If no
        group matches, return an empty string.

        This elides the response code from the server, since it can
        only be '215' or '285' (for xgtitle) anyway.  If the response
        code is needed, use the 'descriptions' method.

        NOTE: This neither checks for a wildcard in 'group' nor does
        it check whether the group actually exists.F�r)rr<s  r�descriptionzNNTP.description�s���$�$�U�E�2�2rc�&�|j|d�S)z'Get descriptions for a range of groups.Tr)rr
s  r�descriptionszNNTP.descriptions�s���$�$�]�D�9�9rc�T�|jd|z�}|jd�st|��|j�}dx}x}}t	|�}|dkDr1|d}|dkDr'|d}|dkDr|d}|dkDr|dj�}|t
|�t
|�t
|�|fS)aProcess a GROUP command.  Argument:
        - group: the group name
        Returns:
        - resp: server response if successful
        - count: number of articles
        - first: first article number
        - last: last article number
        - name: the group name
        zGROUP r(rrQrrrrs)r�rdrrarWrSrb)rrZr��words�countr>r=�ns        rr<z
NNTP.group�s����~�~�h��o�.�����u�%� ��&�&��
�
��� � �� �����J���q�5��!�H�E��1�u��a����q�5� ��8�D��1�u�$�Q�x�~�~�/���S��Z��U��S��Y��<�<rc�&�|jd|�S)aProcess a HELP command. Argument:
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of strings returned by the server in response to the
                HELP command
        �HELP)r�)rr�s  r�helpz	NNTP.help�s���"�"�6�4�0�0rc��|jd�st|��|j�}t|d�}|d}|||fS)z_Internal: parse the response line of a STAT, NEXT, LAST,
        ARTICLE, HEAD or BODY command.�22rQrr)rdrrarb)rr�r!�art_numrBs     r�
_statparsezNNTP._statparse�sI�����t�$� ��&�&��
�
����e�A�h�-���1�X�
��W�j�(�(rc�F�|j|�}|j|�S)z/Internal: process a STAT, NEXT or LAST command.)r�r*)rrYr�s   r�_statcmdz
NNTP._statcmd�s���~�~�d�#�����t�$�$rc�h�|r |jdj|��S|jd�S)a(Process a STAT command.  Argument:
        - message_spec: article number or message id (if not specified,
          the current article is selected)
        Returns:
        - resp: server response if successful
        - art_num: the article number
        - message_id: the message id
        zSTAT {0}�STAT)r,r�)r�message_specs  r�statz	NNTP.stat�s0����=�=��!2�!2�<�!@�A�A��=�=��(�(rc�$�|jd�S)z;Process a NEXT command.  No arguments.  Return as for STAT.�NEXT�r,r�s r�nextz	NNTP.next�����}�}�V�$�$rc�$�|jd�S)z;Process a LAST command.  No arguments.  Return as for STAT.�LASTr3r�s rr=z	NNTP.last�r5rc�t�|j||�\}}|j|�\}}}|t|||�fS)z2Internal: process a HEAD, BODY or ARTICLE command.)r�r*r@)rrYr�r�r9r)rBs       r�_artcmdzNNTP._artcmd�s?���m�m�D�$�/���e�$(�O�O�D�$9�!��g�z��[��*�e�<�<�<rc�R�|�dj|�}nd}|j||�S)a0Process a HEAD command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the headers in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of header lines)
        zHEAD {0}�HEAD�r�r9�rr/r�rs    r�headz	NNTP.head��0���#��#�#�L�1�C��C��|�|�C��&�&rc�R�|�dj|�}nd}|j||�S)a+Process a BODY command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the body in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of body lines)
        zBODY {0}�BODYr<r=s    r�bodyz	NNTP.bodyr?rc�R�|�dj|�}nd}|j||�S)a5Process an ARTICLE command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the article in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of article lines)
        zARTICLE {0}�ARTICLEr<r=s    r�articlezNNTP.articles0���#��&�&�|�4�C��C��|�|�C��&�&rc�$�|jd�S)zYProcess a SLAVE command.  Returns:
        - resp: server response if successful
        �SLAVE)r�r�s r�slavez
NNTP.slave$s���~�~�g�&�&rc���tjd��|jdj||�|�\}}�fd�}||D�cgc]
}||���c}fScc}w)aiProcess an XHDR command (optional server extension).  Arguments:
        - hdr: the header type (e.g. 'subject')
        - str: an article nr, a message id, or a range nr1-nr2
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (nr, value) strings
        z^([0-9]+) ?(.*)
?zXHDR {0} {1}c�R���j|�}|r|jdd�S|S)NrQrr)rr<)rY�m�pats  �r�
remove_numberz NNTP.xhdr.<locals>.remove_number5s'����	�	�$��A�$%�1�7�7�1�a�=�/�4�/r)rrr�r�)	r�hdrr�r�r�r9rMrYrLs	        @r�xhdrz	NNTP.xhdr*s\����j�j�-�.���)�)�.�*?�*?��S�*I�4�P���e�	0��e�<�d�m�D�)�<�<�<��<s�Ac��|jdj||�|�\}}|j�}|t||�fS)aFProcess an XOVER command (optional server extension) Arguments:
        - start: start of range
        - end: end of range
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields
        z
XOVER {0}-{1})r�r�r�rp)r�start�endr�r�r9rXs       r�xoverz
NNTP.xover:sJ���)�)�/�*@�*@���*L�*.�0���e��"�"�$���_�U�C�0�0�0rc�
�d|jvrdnd}t|ttf�r|\}}|dj	||xsd�z
}n
|�|dz|z}|j||�\}}|j
�}|t||�fS)a�Process an OVER command.  If the command isn't supported, fall
        back to XOVER. Arguments:
        - message_spec:
            - either a message id, indicating the article to fetch
              information about
            - or a (start, end) tuple, indicating a range of article numbers;
              if end is None, information up to the newest message will be
              retrieved
            - or None, indicating the current article number must be used
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields

        NOTE: the "message id" form isn't supported by XOVER
        �OVER�XOVERz {0}-{1}rEr�)r�rG�tupler�r�r�r�rp)	rr/r�rrQrRr�r9rXs	         r�overz	NNTP.overHs���"�$�*�*�,�f�'���l�U�D�M�2�%�J�E�3��:�$�$�U�C�I�2�6�6�C�
�
%���)�l�*�C��)�)�#�t�4���e��"�"�$���_�U�C�0�0�0rc��|jd�}|jd�st|��|j�}t	|�dk7rt|��|d}t	|�dk7rt|��|t
|d�fS)z�Process the DATE command.
        Returns:
        - resp: server response if successful
        - date: datetime object
        �DATE�111rrrQ�N)r�rdrrarWrr�)rr��elemr4s    rr4z	NNTP.datecs{���~�~�f�%�����u�%� ��&�&��z�z�|���t�9��>���%�%��A�w���t�9��?���%�%��_�T�4�0�0�0rc��|j|�}|jd�st|��t|tt
f�r|j
�}|D]`}|jt�s|jd�tz}|jd�rd|z}|jj|��b|jjd�|jj�|j�S)N�3r:r�s.
)r�rdrrGr8�	bytearray�
splitlines�endswithr��rstripr�r�r�r�)rr�fr�rYs     r�_postz
NNTP._postts����~�~�g�&�����s�#� ��&�&��a�%��+�,�����A�
�	"�D��=�=��'��{�{�7�+�e�3�����t�$��d�{���I�I�O�O�D�!�	"�	
�	�	����!��	�	�����}�}��rc�&�|jd|�S)z�Process a POST command.  Arguments:
        - data: bytes object, iterable or file containing the article
        Returns:
        - resp: server response if successful�POST)re)r�datas  r�postz	NNTP.post�s��
�z�z�&�$�'�'rc�D�|jdj|�|�S)aProcess an IHAVE command.  Arguments:
        - message_id: message-id of the article
        - data: file containing the article
        Returns:
        - resp: server response if successful
        Note that if the server refuses the article an exception is raised.z	IHAVE {0})rer�)rrBrhs   r�ihavez
NNTP.ihave�s ���z�z�+�,�,�Z�8�$�?�?rc���	|jr|jj�|`|jj�y#|jj�wxYwr�)r�r�r�r�s rr�zNNTP._close�s>��	��y�y��	�	���!��I��I�I�O�O���D�I�I�O�O��s�(A�A!c�t�	|jd�}|j�|S#|j�wxYw)zdProcess a QUIT command and close the socket.  Returns:
        - resp: server response if successful�QUIT)r�r�)rr�s  rr�z	NNTP.quit�s0��	��>�>�&�)�D��K�K�M����
�K�K�M�s�%�7c�l�|jrtd��|s
|std��	|r=|s;ddl}|j�}|j|j�}|r
|d}|d}|sy|j
d|z�}|jd�r=|st|��|j
d|z�}|jd�st|��d|_
|j�|jr7d	|jvr(|j�d|_
|j�yyy#t
$rY��wxYw)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrrzauthinfo user �381zauthinfo pass �281r�)r�r��netrc�authenticatorsr�r�r�rdrr	r�r�r�r�)rr�r�r�rr�credentials�authr�s        rr�z
NNTP.login�s5������1�2�2��H��I�K�
K�
		����#�k�k�m��"�1�1�$�)�)�<�����7�D�#�A�w�H����~�~�.��5�6���?�?�5�!��$�T�*�*��~�~�&6��&A�B�����u�-�,�T�2�2���
������$�$�����)C����!��D�J�� � �"�	*D�$��%�	��	�s�?D'�'	D3�2D3c��	|jd�|_y#t$rYyt$r.}|jjd�rd|_n�Yd}~yd}~wwxYw)Nzmode reader�480T)r�r�r	rrrdr�)r�es  rr�zNNTP._setreadermode�sT��
	��>�>�-�8�D�L��!�	��!�	��z�z�$�$�U�+�,0��)��*��	�s��	A�A�$A�Ac��|jrtd��|jrtd��|jd�}|j	d�r|j
j
�t|j||j�|_|jjd�|_d|_d|_|j�ytd��)	zzProcess a STARTTLS command. Arguments:
            - context: SSL context to use for the encrypted connection
            zTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLS�382r�TNzTLS failed to start.)r�r�r�r�rdr�r�r�r�r�r�r�r�r)rr�r�s   r�starttlsz
NNTP.starttls�s����{�{� �!:�;�;��!�!� �!N�O�O��>�>�*�-�D����u�%��	�	���!�'��	�	�7�D�I�I�F��	� �I�I�.�.�u�5��	�"���"��
��$�$�&�� 6�7�7r)Tr�)NNT):rrrr�r��	NNTP_PORTrrr�r�r�r�r�r�r��debugr�r�r�r�r�r�r�r�r�rr�rr
r�rrrr<r&r*r,r0r4r=r9r>rBrErHrOrSrXr4rerirkr�r�r�r��	_have_sslr|rrrrr+sc���H�
�F�"+�$�� �5�0�!�F #�D�	"�I���,�
�E����"� ,�\�'�(��"<��'+�,� ,0�.� 
,�t�
,��.3�:�=�4 �1�)�%�
)�%�%�=�'�d�'�'�d�'�'��'�'�&*�=� )-�1�*.�1�61�"�*(�@���'#�R��	8�rrc�8��eZdZedddddef�fd�	Z�fd�Z�xZS)�NNTP_SSLNFc		�>��||_t�	|�	|||||||�y)z�This works identically to NNTP.__init__, except for the change
            in default port and the `ssl_context` argument for SSL connections.
            N)�ssl_context�superr)
rr�r�r�r�r�r�r�r�rs
         �rrzNNTP_SSL.__init__�s)��� +�D���G��T�4��x��%�w�
0rc���t�|�|�}	t||j|j�}|S#|j��xYwr�)r�r�r�r�r�r�)rr�r�rs   �rr�zNNTP_SSL._create_socketsI����7�)�'�2�D�
�"�4��)9�)9�4�9�9�E��
���	
��
�
���s	�!5�A)rrr�
NNTP_SSL_PORTrrr��
__classcell__)rs@rr�r��s$���&3���$�#�e�3�		0�	�	rr��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)rz-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr&z-sz--serverz
news.gmane.ioz+NNTP server hostname (default: %(default)s)z-pz--portr�zNNTP port number (default: z / �))r��typer&z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionr�r&)r�r�rz�Group�haszarticles, range�toc�8�t|�|kDr|d|dz
dz}|S)Nrsz...)rW)�s�lims  r�cutr�6s&���q�6�C�<��(�3��7��e�#�A��rrQr3�<r2z{:7} {:20} {:42} ({})��*r�)F)Krrr��collectionsrxr��warningsr�r�ImportError�email.headerrrFr�__all__�_deprecatedrr�rrrrr	r
rr}r�r�rVrTr��
namedtupler;r@r^rpr�r�r�rr�rH�argparse�ArgumentParser�parser�add_argumentrb�
parse_argsrr��serverr�r�r�r|r<r�r"r>r=rZr�r�r��nb_articlesrS�	overviews�artnumrXra�authorr2r9r�r�rrr�<module>r�s����B
�
���
�����I�>�*�
������X�g�.���0�	�0�	�Y�	�	��	�	��	�	�	�	�	�I�	�
�	��
�

�	� O��
�
���	��"�K�"�"�;�#E�
G�	�%�k�$�$�]�%F�H��
	��2�:H�,�4
�
C�K8�K8�\
��4��.�N�N�:���z���
$�X�
$�
$�2N�O�F�
����i�1L�R��T�
����j�/�J��L�
����h���FO�Q^�_��a�
����o�r��Q��S�
����g�l�E�0��2�����D��9�9�D��8�8��2�:��D��d�k�k��-���2�:� �D��$�+�+�D�1������D��T��	�
�
��%&�W�W�T�Z�Z�%8�"�D�%���d�	�'�4���'8�%��t�L��

��D�	�D�,�,�,�q�0�1�E��g�g�e�T�*�O�D�)�!������t�F�|�,�2�2�3��:�1�=����Y��0���D��N�#��
�%�,�,��c�&�"�o�s�7�B�'7��@�	�	��F�F�H�a��U���I��s�K7�7L�L
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!