modos.remote ============ .. py:module:: modos.remote .. autoapi-nested-parse:: Functions related to server storage handling Classes ------- .. autoapisummary:: modos.remote.BearerAuth modos.remote.EndpointManager modos.remote.JWT Functions --------- .. autoapisummary:: modos.remote.get_session modos.remote.list_remote_items modos.remote.get_metadata_from_remote modos.remote.is_s3_path modos.remote.get_s3_path Module Contents --------------- .. py:class:: BearerAuth Bases: :py:obj:`requests.auth.AuthBase` Base class that all auth implementations derive from .. py:attribute:: jwt :value: None .. py:method:: __call__(r) .. py:function:: get_session() .. py:class:: EndpointManager Handle modos server endpoints. If a modos server url is provided, it is used to detect available service urls. Alternatively, service urls can be provided explicitely if no modos server is available. :param modos: URL to the modos server. :param services: Mapping of services to their urls. .. rubric:: Examples >>> ex = EndpointManager(modos="http://modos.example.org") # doctest: +SKIP >>> ex.list() # doctest: +SKIP { 's3: Url('http://s3.example.org/'), 'htsget': Url('http://htsget.example.org/') } >>> ex.htsget # doctest: +SKIP HttpUrl('http://htsget.example.org/') >>> ex = EndpointManager(services={"s3": "http://s3.example.org"}) >>> ex.s3 HttpUrl('http://s3.example.org/') .. py:attribute:: modos :type: Optional[pydantic.HttpUrl] :value: None .. py:attribute:: services :type: dict[str, pydantic.HttpUrl] .. py:property:: session .. py:method:: list() List available endpoints. .. py:property:: s3 :type: Optional[pydantic.HttpUrl] .. py:property:: fuzon :type: Optional[pydantic.HttpUrl] .. py:property:: htsget :type: Optional[pydantic.HttpUrl] .. py:property:: refget :type: Optional[pydantic.HttpUrl] .. py:function:: list_remote_items(url) .. py:function:: get_metadata_from_remote(url, modo_id = None) Function to access metadata from one specific or all modos on a remote server :param server_url: Url to the remote modo server :param id: id of the modo to retrieve metadata from. Will return all if not specified (default). .. py:function:: is_s3_path(path) Check if a path is an S3 path .. py:function:: get_s3_path(url, query, exact_match = False) Request public S3 path of a specific modo or all modos matching the query string :param remote_url: Url to the remote modo server :param query: query string to specify the modo of interest :param exact_match: if True only modos with exactly that id will be returned, otherwise (default) all matching modos .. py:class:: JWT Handles storage of JWT tokens for authentication. .. py:attribute:: access_token :type: str .. py:attribute:: _expires_at :type: Optional[datetime.datetime] :value: None .. py:property:: expires_at .. py:method:: path() :staticmethod: .. py:method:: to_cache() Store JWT in cache directory. .. py:method:: from_cache() :classmethod: Load JWT from cache directory if it exists. .. py:method:: decode() .. py:method:: is_expired(skew = 30) .. py:method:: refresh()