combine_multipart_data (ariadne/file_uploads.py)

ariadne · ariadne/file_uploads.py · python · BSD-3-Clause
integration, Integration / API

Utility to merge multipart file uploads into GraphQL operation variables.

# Source: https://github.com/mirumee/ariadne | License: BSD-3-Clause | Copyright 2025, Mirumee Labs
# Provided via justclaw.it.com; keep this notice with the code.
from collections.abc import Mapping
from typing import Any

from .exceptions import HttpBadRequestError
from .scalars import ScalarType

SPEC_URL = "https://github.com/jaydenseric/graphql-multipart-request-spec"


FilesDict = Mapping[str, Any]


def combine_multipart_data(
    operations: dict | list, files_map: dict, files: FilesDict
) -> dict | list:
    """Populates `operations` variables with `files` using the `files_map`.

    Utility function for integration developers.

    Mutates `operations` in place, but also returns it.

    # Requires arguments

    `operations`: a `list` or `dict` with GraphQL operations to populat

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key