Skip to main content
Glama
cml_client.cpython-313.pyc5.86 kB
� �?h����%SrSSKrSSKrSSKrSSKrSSKJr "SS5rSq\\\ S'S\\4Sjr S \SS4S jr g) zZ CML API Client Handles authentication and HTTP requests to the Cisco Modeling Labs API. �N)�Optionalc �n�\rSrSrSrSS\S\S\S\4SjjrS\4S jrS \S \S\ R4S jr S r g)�CMLAuth�z;Authentication and request handling for Cisco Modeling Labs�base_url�username�password� verify_sslc�(�XlX lX0lSUlX@l[ R "XS9UlU(d+SSKnURURR5 gg![a [S[RS9 gf=f)z� Initialize the CML authentication client Args: base_url: Base URL of the CML server username: Username for CML authentication password: Password for CML authentication verify_ssl: Whether to verify SSL certificates N)r�verifyrz7urllib3 not available, SSL warning suppression disabled��file)rrr �tokenr �httpx� AsyncClient�client�urllib3�disable_warnings� exceptions�InsecureRequestWarning� ImportError�print�sys�stderr)�selfrrr r rs �VC:\Users\jscon\Documents\Python_Projects\Claude-Modeling-Labs\src\client\cml_client.py�__init__�CMLAuth.__init__s���!� � � � � ��� �$���'�'��M�� �� b���(�(��);�);�)R�)R�S���� b��O�VY�V`�V`�a� b�s�)A,�,"B�B�returnc���# �[SUR3[RS9 URR SUR URS.S9IShv�N nUR5 URRS5Ul URRRSS UR305 URRS 5IShv�N nUR5 [S [RS9 UR$N�N:![a9n[S [!U53[RS9 SnAUR$SnAff=f7f) z� Authenticate with CML and get a token Returns: Authentication token Raises: httpx.HTTPStatusError: If authentication fails zAuthenticating with CML at r z/api/v0/authenticate)rr )�jsonN�"� Authorization�Bearer z/api/v0/authokz)Authentication successful, token verifiedz$Warning: Token verification failed: )rrrrr�postrr �raise_for_status�text�stripr�headers�update�get� Exception�str)r�response� auth_check�es r� authenticate�CMLAuth.authenticate*s#��� �+�D�M�M�?�;�#�*�*�M����)�)� "�"�m�m����G�*� � �� �!�!�#��]�]�(�(��-�� � � � ���"�"�O�w�t�z�z�l�5K�#L�M� T�#�{�{���/?�@�@�J� � '� '� )� �=�S�Z�Z� P��z�z��! �A��� T� �8��Q���A�� � � S��z�z��� T�sO�AE'�D�A(E'�D!�$D�%,D!� E'�D!�! E$�+$E�E'�E$�$E'�method�endpointc��# �UR(dUR5IShv�N [SUSU3[RS9 SU;a0US'SUR3USS'UR R "X40UD6IShv�N nURS:Xaj[S [RS9 UR5IShv�N SUR3USS'UR R "X40UD6IShv�N nUR5 U$N�N�NTN![a*n[S [U53[RS9 eSnAff=f7f) a Make an authenticated request to CML API Args: method: HTTP method (GET, POST, PUT, DELETE) endpoint: API endpoint to call **kwargs: Additional arguments to pass to httpx Returns: HTTP response Raises: httpx.HTTPStatusError: If the request fails NzMaking z request to r r)r$r#i�z&Got 401 response, re-authenticating...zRequest error: ) rr1rrrr�request� status_coder&r,r-)rr3r4�kwargsr.r0s rr6�CMLAuth.requestGsF����z�z��#�#�%� %� %� ���x�|�H�:�6�S�Z�Z�H� �F� "� "�F�9� �07�t�z�z�l�-C��y��/�*� �!�[�[�0�0��L�V�L�L�H��#�#�s�*��>�c�j�j�Q��'�'�)�)�)�7>�t�z�z�l�5K��y�!�/�2�!%���!4�!4�V�!P��!P�P�� � %� %� '��O�1 &�M� *�P��� � �O�C��F�8�,�3�:�:� >� �� �sj�%E�D�AE�+ D$� D� ?D$� D � 9D$�D"�D$�E�D$� D$�"D$�$ E�.%E�E�E)rrr rrr N)T) �__name__� __module__� __qualname__�__firstlineno__�__doc__r-�boolrr1r�Responser6�__static_attributes__��rrrsV��E�b��b��b�s�b�PT�b�2�C��:+�C�+�3�+�U�^�^�+rCr�cml_authrc��[$)z#Get the current CML client instance�rDrBrCr� get_clientrGys�� �OrCrc��Uqg)zSet the CML client instanceNrF)rs r� set_clientrI~s ���HrC) r>�osrr� traceback�typingrrrD�__annotations__rGrIrBrCr�<module>rNs]���  � � ���d�d�P#��(�7� �"��H�W�%�� �w��4�rC

Latest Blog Posts

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/MediocreTriumph/claude-cml-toolkit'

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