How to use the vortexasdk.endpoints.products.Products function in vortexasdk

To help you get started, we’ve selected a few vortexasdk 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 V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_search_ids_dataframe_subset_of_cols(self):
        ids = [
            "e166e6253dd843624f6cbe4fd45e7f2cff4671e600b4d6371172dd92a0255946",
            "6cd99c8f9e67e61892a691237b3342a4caae5ec1c76784b1b93952afda44ae24",
        ]

        df = Products().search(ids=ids).to_df(columns=["name", "id"])
        assert list(df.columns) == ["name", "id"]
        assert len(df) == 2
github V0RT3X4 / python-sdk / tests / endpoints / test_products.py View on Github external
def test_search_ids_retreives_names(self):
        products = Products().search().to_df()
        assert len(products) > 0
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_search_ids(self):
        ids = [
            "e166e6253dd843624f6cbe4fd45e7f2cff4671e600b4d6371172dd92a0255946",
            "6cd99c8f9e67e61892a691237b3342a4caae5ec1c76784b1b93952afda44ae24",
        ]

        products = Products().search(ids=ids).to_list()
        assert len(products) == 2

        print([x.name for x in products])
github V0RT3X4 / python-sdk / tests / endpoints / test_products.py View on Github external
def test_to_list(self):
        Products().search().to_list()
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_search_crude(self):
        set_client(create_client())

        result = [p.id for p in Products().search("Crude").to_list()]

        assert (
            "6f11b0724c9a4e85ffa7f1445bc768f054af755a090118dcf99f14745c261653"
            in result
        )
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_search_ids_dataframe(self):
        ids = [
            "e166e6253dd843624f6cbe4fd45e7f2cff4671e600b4d6371172dd92a0255946",
            "6cd99c8f9e67e61892a691237b3342a4caae5ec1c76784b1b93952afda44ae24",
        ]

        df = Products().search(ids=ids).to_df()
        assert list(df.columns) == DEFAULT_COLUMNS
        assert len(df) == 2
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_search_multiple_terms_to_dataframe(self):
        df = (
            Products()
            .search(term=["diesel", "fuel oil", "grane"])
            .to_df("all")
        )

        assert set(df.columns) == {
            "id",
            "name",
            "layer.0",
            "leaf",
            "parent.0.name",
            "parent.0.layer.0",
            "parent.0.id",
            "meta.api_min",
            "meta.api_max",
            "ref_type",
            "meta.sulphur_min",
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_load_all(self):
        all_products = Products().load_all()

        assert len(all_products) > 100
github V0RT3X4 / python-sdk / tests / endpoints / test_products_real.py View on Github external
def test_lookup_crude(self):
        set_client(create_client())

        result = Products().reference(
            "6f11b0724c9a4e85ffa7f1445bc768f054af755a090118dcf99f14745c261653"
        )

        assert result["name"] == "Crude"
github V0RT3X4 / python-sdk / vortexasdk / conversions / products.py View on Github external
def convert_to_product_ids(
    ids_or_names_list: List[Union[ID, str]]
) -> List[ID]:
    """
    Convert a mixed list of names or IDs to vessel ids.

    # Example
    ```
    >>> convert_to_product_ids(["crude"])
    [...]

    ```
    """
    return _convert_to_ids(ids_or_names_list, Products())