How to use the descarteslabs.client.deprecation.check_deprecated_kwargs function in descarteslabs

To help you get started, we’ve selected a few descarteslabs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
def _add_core_product(self, product_id, **kwargs):
        kwargs["id"] = product_id
        check_deprecated_kwargs(
            kwargs, {"start_time": "start_datetime", "end_time": "end_datetime"}
        )
        r = self.session.post("/core/products", json=kwargs)
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
- See :meth:`add_image` for additional kwargs.

        :rtype: dict
        :return: JSON API representation of the band. See :meth:`get_image`
            for information about returned keys.

        :raises ~descarteslabs.client.exceptions.BadRequestError: Raised when
            the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            image cannot be found.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        check_deprecated_kwargs(kwargs, {"bpp": "bits_per_pixel"})
        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)
        r = self.session.patch(
            "/products/{}/images/{}".format(product_id, image_id), json=kwargs
        )
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.ConflictError: Raised when
            a band with the specified name already exists.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """

        for k, v in locals().items():
            if k in ["name", "data_range", "dtype", "srcband", "type"]:
                if v is None:
                    raise TypeError("required arg `{}` not provided".format(k))
                kwargs[k] = v
        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)
        check_deprecated_kwargs(kwargs, {"id": "name", "nbits": None})

        r = self.session.post("/products/{}/bands".format(product_id), json=kwargs)
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
:rtype: dict
        :return: JSON API representation of the band. See :meth:`get_image`
            for information about returned keys.

        :raises ~descarteslabs.client.exceptions.BadRequestError: Raised when
            the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.ConflictError: Raised when
            a image with the specified ID already exists.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        check_deprecated_kwargs(kwargs, {"bpp": "bits_per_pixel", "key": "image_id"})
        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)
        kwargs["id"] = image_id
        kwargs["storage_state"] = storage_state
        r = self.session.post("/products/{}/images".format(product_id), json=kwargs)
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
or users having write access.
                                                Access Control List identifiers
                                                can have the following formats:
                                                organizations, e.g. org:orgname.
                                                groups, e.g. group:groupname.
                                                user email, e.g. email:user@company.com.

        :raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            image cannot be found.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)

        r = self.session.get("/products/{}/images/{}".format(product_id, image_id))
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
:param list(str) writers: A list of groups, or user hashes to give read access to.

        :rtype: dict
        :return: JSON API representation of the product. See :meth:`get_product`
            for information about returned keys.

        :raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            product cannot be found.
        :raises ~descarteslabs.client.exceptions.BadRequestError: Raised when
            the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        check_deprecated_kwargs(
            kwargs, {"start_time": "start_datetime", "end_time": "end_datetime"}
        )

        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)

        params = None
        if set_global_permissions is True:
            params = {"set_global_permissions": "true"}

        r = self.session.patch(
            "/products/{}".format(product_id), json=kwargs, params=params
        )
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
:raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            band cannot be found.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """

        for k, v in locals().items():
            if k in ["data_range", "dtype", "srcband", "type"]:
                if v is None:
                    raise TypeError("required arg `{}` not provided".format(k))
                kwargs[k] = v
        check_deprecated_kwargs(kwargs, {"nbits": None})
        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)

        r = self.session.put(
            "/products/{}/bands/{}".format(product_id, name), json=kwargs
        )
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
:raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            product cannot be found.
        :raises ~descarteslabs.client.exceptions.BadRequestError: Raised when
            the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        check_deprecated_kwargs(
            kwargs, {"start_time": "start_datetime", "end_time": "end_datetime"}
        )

        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)

        params = None
        if set_global_permissions is True:
            params = {"set_global_permissions": "true"}

        r = self.session.patch(
            "/products/{}".format(product_id), json=kwargs, params=params
        )
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
def _add_core_band(
        self,
        product_id,
        name,
        srcband=None,
        dtype=None,
        data_range=None,
        type=None,
        **kwargs
    ):
        for k, v in locals().items():
            if k in ["name", "data_range", "dtype", "srcband", "type"]:
                if v is None:
                    raise TypeError("required arg `{}` not provided".format(k))
                kwargs[k] = v
        check_deprecated_kwargs(kwargs, {"nbits": None})
        kwargs["id"] = name
        r = self.session.post("/core/products/{}/bands".format(product_id), json=kwargs)
        return r.json()
github descarteslabs / descarteslabs-python / descarteslabs / client / services / catalog / catalog.py View on Github external
:raises ~descarteslabs.client.exceptions.NotFoundError: Raised if the
            product cannot be found.
        :raises ~descarteslabs.client.exceptions.BadRequestError: Raised when
            the request is malformed, e.g. the owners list is missing prefixes.
        :raises ~descarteslabs.client.exceptions.RateLimitError: Raised when
            too many requests have been made within a given time period.
        :raises ~descarteslabs.client.exceptions.ServerError: Raised when
            a unknown error occurred on the server.
        """
        for k, v in locals().items():
            if k in ["title", "description"]:
                if v is None:
                    raise TypeError("required arg `{}` not provided".format(k))
                kwargs[k] = v
        check_deprecated_kwargs(
            kwargs, {"start_time": "start_datetime", "end_time": "end_datetime"}
        )

        if add_namespace:
            check_deprecated_kwargs(locals(), {"add_namespace": None})
            product_id = self.namespace_product(product_id)

        params = None
        if set_global_permissions is True:
            params = {"set_global_permissions": "true"}

        r = self.session.put(
            "/products/{}".format(product_id), json=kwargs, params=params
        )
        return r.json()