oasislmf.platform_api.session ============================= .. py:module:: oasislmf.platform_api.session Classes ------- .. autoapisummary:: oasislmf.platform_api.session.APISession Module Contents --------------- .. py:class:: APISession(api_url, username, password, timeout=25, retries=5, retry_delay=1, request_interval=0.02, logger=None, **kwargs) Bases: :py:obj:`requests.Session` A Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') .. py:attribute:: logger .. py:attribute:: tkn_access :value: None .. py:attribute:: tkn_refresh :value: None .. py:attribute:: url_base .. py:attribute:: timeout .. py:attribute:: retry_max :value: 0 .. py:attribute:: retry_delay .. py:attribute:: request_interval .. py:attribute:: headers .. py:method:: unrecoverable_error(error, msg=None) .. py:method:: health_check() Checks the health of the server. .. py:method:: upload(url, filepath, content_type, **kwargs) .. py:method:: get(url, **kwargs) 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 .. py:method:: post(url, **kwargs) 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 .. py:method:: delete(url, **kwargs) 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 .. py:method:: put(url, **kwargs) Sends 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