Skip to content

Examples#

Index > Neptune > Examples

Auto-generated documentation for Neptune type annotations stubs module types-aiobotocore-neptune.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[neptune] package installed.

Write your Neptune code as usual, type checking and code completion should work out of the box.

# NeptuneClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("neptune") as client:  # (1)
    result = await client.add_role_to_db_cluster()  # (2)
  1. client: NeptuneClient
  2. result: EmptyResponseMetadataTypeDef
# DescribeDBClusterEndpointsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("neptune") as client:  # (1)
    paginator = client.get_paginator("describe_db_cluster_endpoints")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: NeptuneClient
  2. paginator: DescribeDBClusterEndpointsPaginator
  3. item: DBClusterEndpointMessageTypeDef
# DBInstanceAvailableWaiter usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("neptune") as client:  # (1)
    waiter = client.get_waiter("db_instance_available")  # (2)
    await waiter.wait()
  1. client: NeptuneClient
  2. waiter: DBInstanceAvailableWaiter

Explicit type annotations#

With types-aiobotocore-lite[neptune] or a standalone types_aiobotocore_neptune package, you have to explicitly specify client: NeptuneClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# NeptuneClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.type_defs import EmptyResponseMetadataTypeDef
from types_aiobotocore_neptune.type_defs import AddRoleToDBClusterMessageRequestTypeDef


session = get_session()

async with session.create_client("neptune") as client:
    client: NeptuneClient
    kwargs: AddRoleToDBClusterMessageRequestTypeDef = {...}
    result: EmptyResponseMetadataTypeDef = await client.add_role_to_db_cluster(**kwargs)
# DescribeDBClusterEndpointsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.paginator import DescribeDBClusterEndpointsPaginator
from types_aiobotocore_neptune.type_defs import DBClusterEndpointMessageTypeDef


session = get_session()

async with session.create_client("neptune") as client:
    client: NeptuneClient
    paginator: DescribeDBClusterEndpointsPaginator = client.get_paginator("describe_db_cluster_endpoints")
    async for item in paginator.paginate(...):
        item: DBClusterEndpointMessageTypeDef
        print(item)
# DBInstanceAvailableWaiter usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.waiter import DBInstanceAvailableWaiter


session = get_session()

async with session.create_client("neptune") as client:
    client: NeptuneClient
    waiter: DBInstanceAvailableWaiter = client.get_waiter("db_instance_available")
    await waiter.wait()