mypy-boto3-gameliftstreams

1.42.68 · active · verified Sat Apr 11

mypy-boto3-gameliftstreams provides type annotations for the boto3 GameLiftStreams service. It enhances static analysis for boto3 client calls related to GameLift Streams, offering improved autocompletion and error checking in IDEs and with type checkers like Mypy. The library is actively maintained, with releases tied to upstream boto3 updates and its generator, mypy-boto3-builder.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-checked GameLiftStreams client from a boto3 session and call a basic operation like `list_streams`. The `TYPE_CHECKING` block ensures that type-specific imports are only active during static analysis, avoiding runtime dependencies on `mypy-boto3-gameliftstreams`.

import os
from typing import TYPE_CHECKING
from boto3.session import Session

# These imports are for type-checking only
if TYPE_CHECKING:
    from mypy_boto3_gameliftstreams.client import GameLiftStreamsClient
    from mypy_boto3_gameliftstreams.type_defs import ListStreamsOutputTypeDef

# Configure AWS credentials if not using environment variables/profile
# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')
# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')
# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')

def get_gamelift_streams_client() -> "GameLiftStreamsClient":
    session = Session()
    client: GameLiftStreamsClient = session.client("gamelift-streams")
    return client

def list_gamelift_streams():
    client = get_gamelift_streams_client()
    try:
        # Example: List GameLift Streams (replace with actual method if 'list_streams' is not relevant or requires args)
        response: ListStreamsOutputTypeDef = client.list_streams()
        print("Successfully listed GameLift Streams.")
        # Process response here
        # For example, if there were a 'Streams' key with a list of stream data:
        # for stream in response.get('Streams', []):
        #     print(f"  Stream ARN: {stream.get('StreamArn')}")
        print(response)
    except client.exceptions.ClientError as e:
        print(f"Error listing GameLift Streams: {e}")

if __name__ == "__main__":
    list_gamelift_streams()

view raw JSON →