Skip to main content
Glama

ClickUp Operator

by noah-vh
sessions.cpython-312.pyc27.8 kB
� lMgw���dZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z dd lmZmZmZmZdd lmZmZmZmZdd lmZmZmZmZdd lmZmZdd l m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ejhdk(r ejjZ6n ejZ6efd�Z7efd�Z8Gd�d�Z9Gd�de9�Z:d�Z;y)z� requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). �N)� OrderedDict)� timedelta�)�to_native_string)� HTTPAdapter)�_basic_auth_str)�Mapping� cookielib�urljoin�urlparse)�RequestsCookieJar�cookiejar_from_dict�extract_cookies_to_jar� merge_cookies)�ChunkedEncodingError�ContentDecodingError� InvalidSchema�TooManyRedirects)� default_hooks� dispatch_hook)�DEFAULT_REDIRECT_LIMIT�REDIRECT_STATI�PreparedRequest�Request)�codes)�CaseInsensitiveDict) � DEFAULT_PORTS�default_headers�get_auth_from_url�get_environ_proxies�get_netrc_auth� requote_uri�resolve_proxies� rewind_body�should_bypass_proxies�to_key_val_list�win32c��|�|S|�|St|t�rt|t�s|S|t|��}|jt|��|j �D��cgc] \}}|�� |�� }}}|D]}||=�|Scc}}w)z�Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` )� isinstancer r&�update�items)�request_setting�session_setting� dict_class�merged_setting�k�v� none_keys�keys �]C:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\requests/sessions.py� merge_settingr5=s��� �������� �?�G�,��O�W�1U������ @�A�N����/�/�:�;�"0�!5�!5�!7�E�!7�v��1�1�9��!7�I�E��� �3� �� ��� Fs �) B�4Bc�|�|�|jd�gk(r|S|�|jd�gk(r|St|||�S)z�Properly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. �response)�getr5)� request_hooks� session_hooksr.s r4� merge_hooksr;[sO�� �� � 1� 1�*� =�� C����� � 1� 1�*� =�� C��� �� �z� B�B�c�>�eZdZd�Zd�Z dd�Zd�Zd�Zd�Zy) �SessionRedirectMixinc�t�|jr,|jd}|jd�}t|d�Sy)z7Receives a Response. Returns a redirect URI or ``None``�location�latin1�utf8N)� is_redirect�headers�encoder)�self�respr@s r4�get_redirect_targetz(SessionRedirectMixin.get_redirect_targetks;�� � � ��|�|�J�/�H� ���x�0�H�#�H�f�5� 5�r<c���t|�}t|�}|j|jk7ry|jdk(r,|jdvr|jdk(r|jdvry|j|jk7}|j|jk7}t j |jd�df}|s|j|vr|j|vry|xs|S)zFDecide whether Authorization header should be removed when redirectingT�http)�PN�https)i�NFN)r �hostname�scheme�portrr8)rF�old_url�new_url� old_parsed� new_parsed� changed_port�changed_scheme� default_ports r4�should_strip_authz&SessionRedirectMixin.should_strip_auths����g�&� ��g�&� � � � �*�"5�"5� 5�� � � �� '����:�-��!�!�W�,����;�.��"���*�/�/�9� �#�*�*�j�.?�.?�?��%�)�)�*�*;�*;�T�B�D�I� �����<�/����<�/���-�~�-r<Nc +��K�g} |j|�} t|j�j} | �r�|j �} | j |�| dd|_ |jt|j �|jk\rtd|j�d�|���|j!�| j#d�r;t|j�}d j%t'|j(�| g�} t| �}|jd k(r| r|j+| � �}n|jr |j} |j-�} |j.s t1|jt3| ��} n t3| �} t'| �| _|j5| |�|j6t8j:t8j<fvr,d }|D]}| j>jA|d�� d| _!| j>}|jAd d�tE| jF||j�tI| jF|jJ�| jM| jF�|jO| |�}|jQ| |�| jRduxr d|vxsd|v}|r tU| �| }|r|��nP|jV|f|||||dd�| ��}tE|jJ| |j�|j|�} |��| r���yy#tttf$r |jjd��Y���wxYw�w)zBReceives a Response. Returns a generator of Responses or Requests.rNF)�decode_contentz Exceeded z redirects.)r7z//�:�)�fragment)�Content-Lengthz Content-Type�Transfer-Encoding�Cookier]r^)�stream�timeout�verify�cert�proxies�allow_redirects),rHr �urlr\�copy�append�history�contentrr� RuntimeError�raw�read�len� max_redirectsr�close� startswith�joinrrN�_replace�geturl�netlocr r"�rebuild_method� status_coder�temporary_redirect�permanent_redirectrD�pop�bodyr�_cookiesr�cookies�prepare_cookies�rebuild_proxies� rebuild_auth�_body_positionr$�send)rFrG�reqr`rarbrcrd�yield_requests�adapter_kwargs�histrf�previous_fragment�prepared_request� parsed_rurl�parsed�purged_headers�headerrD� rewindables r4�resolve_redirectsz&SessionRedirectMixin.resolve_redirects�s-�������&�&�t�,��$�S�W�W�-�6�6���"�x�x�z� � �K�K�� ����8�D�L� 4�� � ��4�<�<� �D�$6�$6�6�&��� 2� 2�3�;�?�$��� �J�J�L��~�~�d�#�&�t�x�x�0� ��h�h� 0��1C�1C� D�c�J�K���c�]�F����"�$�):����2C��D�����$*�O�O�!��-�-�/�C� �=�=��d�h�h� �C�(8�9��!�#�&��#3�C�#8� � � � � � 0�$� 7�����(�(��(�(�(�� "Y��,�F�$�,�,�0�0���>�-�(,� �%�&�.�.�G� �K�K��$� '� #�#3�#<�#<�c�4�8�8� L� �*�3�3�T�\�\� B� � ,� ,�-=�-F�-F� G��*�*�+;�W�E�G� � � �.�� 5� *�8�8��D�� �G�+�M�/B�g�/M� � ��,�-�#�C��� � �t�y�y�� �!�#�!��#�$)� �%� ��'�t�|�|�5E�t�x�x�P��.�.�t�4��� �O��)�*>� �M� 4���� � �U� �3� 4�s1�A!M,�$ L5�0KM,�3M,�50M)�%M,�(M)�)M,c���|j}|j}d|vr)|j|jj|�r|d=|jr t |�nd}|�|j |�yy)z�When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. � AuthorizationN)rDrfrW�request� trust_envr!� prepare_auth)rFr�r7rDrf�new_auths r4r�z!SessionRedirectMixin.rebuild_authsw�� #�*�*���"�"�� �g� %�$�*@�*@� � � � � �#�+ � ��(�+/�.�.�>�#�&�d�� � � � )� )�(� 3� r<c�,�|j}t|j�j}t |||j �}d|vr|d= t ||�\}}|jd�s|r|rt||�|d<|S#t$rd\}}Y�6wxYw)a�This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect). This method also replaces the Proxy-Authorization header where necessary. :rtype: dict zProxy-Authorization�NNrL) rDr rfrNr#r�r�KeyErrorrqr)rFr�rdrDrN� new_proxies�username�passwords r4rz$SessionRedirectMixin.rebuild_proxies.s���#�*�*���*�.�.�/�6�6��%�&6�����P� � �G� +��-�.� ,�!2�;�v�3F�!G� �H�h� � � ��)�h�8�-<�X�x�-P�G�)� *����� ,�!+� �H�h� ,�s� B�B�Bc��|j}|jtjk(r|dk7rd}|jtjk(r|dk7rd}|jtj k(r|dk(rd}||_y)z�When being redirected we may want to change the method of the request based on certain specs or browser behavior. �HEAD�GET�POSTN)�methodrwr� see_other�found�moved)rFr�r7r�s r4rvz#SessionRedirectMixin.rebuild_methodMsx��"�(�(�� � � �5�?�?� 2�v��7G��F� � � �5�;�;� .�6�V�3C��F� � � �5�;�;� .�6�V�3C��F�"(��r<)FNTNNF) �__name__� __module__� __qualname__rHrWr�r�rrv�r<r4r>r>js7���(.�H��� ���y�v4�(�>)r<r>c��eZdZdZgd�Zd�Zd�Zd�Zd�Z dd�Z d �Z d �Z d �Z dd �Z dd �Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�Sessiona�A Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') <Response [200]> Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') <Response [200]> ) rDr}�authrd�hooks�paramsrbrc�adaptersr`r�roc�^�t�|_d|_i|_t �|_i|_d|_d|_d|_ t|_ d|_ ti�|_t�|_|j#dt%��|j#dt%��y)NFTzhttps://zhttp://)rrDr�rdrr�r�r`rbrcrror�rr}rr��mountr�rFs r4�__init__zSession.__init__�s���'�(�� ��� � �� �#�_�� � �� ��� ��� ��� � 4������ +�2�.�� �$� �� � � � �:�{�}�-� � � �9�k�m�,r<c��|S�Nr�r�s r4� __enter__zSession.__enter__�s��� r<c�$�|j�yr�)rp)rF�argss r4�__exit__zSession.__exit__�s �� � � � r<c���|jxsi}t|tj�s t |�}t t t �|j�|�}|j}|jr#|s!|jst|j�}t�}|j|jj�|j|j|j |j"t%|j&|j&t(��t%|j*|j*�t%||j�|t-|j.|j.��� |S)a�Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest )r.) r�rf�files�data�jsonrDr�r�r}r�)r}r)r � CookieJarrrr r�r�r!rfr�preparer��upperr�r�r�r5rDrr�r;r�)rFr�r}�merged_cookiesr��ps r4�prepare_requestzSession.prepare_request�s���/�/�'�R���'�9�#6�#6�7�)�'�2�G�'� �+�-�t�|�|� <�g� �� �|�|�� �>�>�$�t�y�y�!�'�+�+�.�D� � �� � � ��>�>�'�'�)�� � ��-�-�������!�������:M��!�������=��t�T�Y�Y�/�"��g�m�m�T�Z�Z�8� � ��r<Nc ��t|j�||||xsi||xsi||| �� }|j|�}| xsi} |j|j| | ||�}| | d�}|j |�|j |fi|��}|S)a� Constructs a :class:`Request <Request>`, prepares it and sends it. Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param hooks: (optional) Dictionary mapping hook name to one event or list of events, event must be callable. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. When set to ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response ) r�rfrDr�r�r�r�r�r}r�)rare)rr�r��merge_environment_settingsrfr*r�)rFr�rfr�r�rDr}r�r�rarerdr�r`rbrcr�r��prep�settings� send_kwargsrGs r4r�zSession.request�s���~��<�<�>���������<�R����  ���#�#�C�(���-�R���2�2� �H�H�g�v�v�t� �� �.� � � ���8�$��t�y�y��-��-��� r<c �N�|jdd�|jd|fi|��S)z�Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response reTr��� setdefaultr��rFrf�kwargss r4r8z Session.getQs-�� ���+�T�2��t�|�|�E�3�1�&�1�1r<c �N�|jdd�|jd|fi|��S)z�Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response reT�OPTIONSr�r�s r4�optionszSession.options\s-�� ���+�T�2��t�|�|�I�s�5�f�5�5r<c �N�|jdd�|jd|fi|��S)z�Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response reFr�r�r�s r4�headz Session.headgs-�� ���+�U�3��t�|�|�F�C�2�6�2�2r<c �0�|jd|f||d�|��S)a�Sends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response r�)r�r��r�)rFrfr�r�r�s r4�postz Session.postrs#���t�|�|�F�C�H�d��H��H�Hr<c �.�|jd|fd|i|��S)auSends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response �PUTr�r��rFrfr�r�s r4�putz Session.puts!���t�|�|�E�3�<�T�<�V�<�<r<c �.�|jd|fd|i|��S)awSends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response �PATCHr�r�r�s r4�patchz Session.patch�s!���t�|�|�G�S�>�t�>�v�>�>r<c �*�|jd|fi|��S)z�Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response �DELETEr�r�s r4�deletezSession.delete�s���t�|�|�H�c�4�V�4�4r<c �f�|jd|j�|jd|j�|jd|j�d|vr$t ||j |j �|d<t|t�r td��|jdd�}|jd�}|j}|j|j��}t�}|j |fi|��}t�|z } t#| � �|_t'd ||fi|��}|j(r<|j(D]-} t+|j,| j.| j0��/t+|j,||j0�|r$|j2||fi|��} | D� cgc]} | ��} } ng} | r)| j5d |�| j�}| |_|s% t7|j2||fd di|���|_|s |j<|Scc} w#t:$rY� wxYw) zISend a given PreparedRequest. :rtype: requests.Response r`rbrcrdz#You can only send PreparedRequests.reT)rf)�secondsr7rr�)r�r`rbrcr#rdr�r)r� ValueErrorrzr8r�� get_adapterrf�preferred_clockr�r�elapsedrrirr}r�rlr��insert�next�_next� StopIterationrj) rFr�r�rer`r��adapter�start�rr�rG�genris r4r�z Session.send�s �� ���(�D�K�K�0����(�D�K�K�0����&�$�)�)�,� �F� "� /�����t�~�~� V�F�9� � �g�w� '��B�C� C�!�*�*�%6��=�����H�%��� � ���"�"�w�{�{�"�3�� �!�� �G�L�L�� +�F� +��"�#�e�+���g�.�� � �*�e�Q� 9�&� 9�� �9�9�� � ��&�t�|�|�T�\�\�4�8�8�L�"� �t�|�|�W�a�e�e�<� �(�$�(�(��G�>�v�>�C�(+�,���t��G�,��G� � �N�N�1�a� �� � � �A��A�I�� ��*�D�*�*�1�g�U�d�U�f�U���� � �I�I����1-��$!� �� �s�/ H�+$H$�$ H0�/H0c��|jr�|�|jd�nd}t||��}|j�D]\}} |j || ��|dus|�Dt j jd�xs#t j jd�xs|}t||j�}t||j�}t||j�}t||j�}||||d�S)z^ Check the environment and merge it with some settings. :rtype: dict N�no_proxy)r�T�REQUESTS_CA_BUNDLE�CURL_CA_BUNDLE)rdr`rbrc) r�r8r r+r��os�environr5rdr`rbrc) rFrfrdr`rbrcr�� env_proxiesr0r1s r4r�z"Session.merge_environment_settings�s��� �>�>�29�2E�w�{�{�:�.�4�H�-�c�H�E�K�#�)�)�+���1��"�"�1�a�(�,� ��~����J�J�N�N�#7�8���z�z�~�~�&6�7���� �����6���v�t�{�{�3���v�t�{�{�3���T�4�9�9�-��"�f��PT�U�Ur<c���|jj�D]6\}}|j�j|j��s�4|cSt d|����)z~ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter z&No connection adapters were found for )r�r+�lowerrqr)rFrf�prefixr�s r4r�zSession.get_adapter sS�� $�}�}�2�2�4�O�F�G��y�y�{�%�%�f�l�l�n�5��� 5� �D�S�G�L�M�Mr<c�b�|jj�D]}|j��y)z+Closes all adapters and as such the sessionN)r��valuesrp)rFr1s r4rpz Session.closes"�����%�%�'�A� �G�G�I�(r<c���||j|<|jD�cgc]}t|�t|�ks�|��}}|D]*}|jj|�|j|<�,ycc}w)zwRegisters a connection adapter to a prefix. Adapters are sorted in descending order by prefix length. N)r�rnrz)rFr�r�r0� keys_to_mover3s r4r�z Session.mountsf�� !(�� � �f��#'�=�=�I�=�a�C��F�S��[�4H��=� �I��C�!%���!2�!2�3�!7�D�M�M�#� � ��Js �A1�A1c �Z�|jD�cic]}|t||d���}}|Scc}wr�)� __attrs__�getattr)rF�attr�states r4� __getstate__zSession.__getstate__*s3��=A�^�^�L�^�T��w�t�T�4�0�0�^��L�� ��Ms�(c�N�|j�D]\}}t|||��yr�)r+�setattr)rFr�r��values r4� __setstate__zSession.__setstate__.s"�� �;�;�=�K�D�%� �D�$�� &�)r<)NNNNNNNTNNNNNNr�r�)r�r�r��__doc__r�r�r�r�r�r�r8r�r�r�r�r�r�r�r�r�rpr�r�rr�r<r4r�r�ds����$ �I�;-�z��)�^� ���� ������� � �#[�z 2� 6� 3� I� =� ?�5�K�ZV�> N�� 8��'r<r�c��t�S)aZ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session )r�r�r<r4�sessionr3s �� �9�r<)<rr��sys�time� collectionsr�datetimer�_internal_utilsrr�rr�r�compatr r r r r}r rrr� exceptionsrrrrr�rr�modelsrrrr� status_codesr� structuresr�utilsrrrr r!r"r#r$r%r&�platform� perf_counterr�r5r;r>r�rr�r<r4�<module>rs���� � � �#��-�!�!�9�9��� �� 0���  �+� � � ��<�<�7���'�'�O��i�i�O�@K��<:E� C�w)�w)�tL'�"�L'�^ r<

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/noah-vh/mcp-server-clickup'

If you have feedback or need assistance with the MCP directory API, please join our Discord server