gql.transport¶
-
class
gql.transport.transport.
Transport
¶ Bases:
object
-
close
()¶ Close the transport
This method doesn’t have to be implemented unless the transport would benefit from it. This is currently used by the RequestsHTTPTransport transport to close the session’s connection pool.
-
connect
()¶ Establish a session with the transport.
-
abstract
execute
(document: graphql.language.ast.DocumentNode, *args, **kwargs) → graphql.execution.execute.ExecutionResult¶ Execute GraphQL query.
Execute the provided document AST for either a remote or local GraphQL Schema.
- Parameters
document – GraphQL query as AST Node or Document object.
- Returns
ExecutionResult
-
-
class
gql.transport.async_transport.
AsyncTransport
¶ Bases:
object
-
abstract async
close
()¶ Coroutine used to Close an established connection
-
abstract async
connect
()¶ Coroutine used to create a connection to the specified address
-
abstract async
execute
(document: graphql.language.ast.DocumentNode, variable_values: Optional[Dict[str, Any]] = None, operation_name: Optional[str] = None) → graphql.execution.execute.ExecutionResult¶ Execute the provided document AST for either a remote or local GraphQL Schema.
-
abstract
subscribe
(document: graphql.language.ast.DocumentNode, variable_values: Optional[Dict[str, Any]] = None, operation_name: Optional[str] = None) → AsyncGenerator[graphql.execution.execute.ExecutionResult, None]¶ Send a query and receive the results using an async generator
The query can be a graphql query, mutation or subscription
The results are sent as an ExecutionResult object
-
abstract async
-
class
gql.transport.local_schema.
LocalSchemaTransport
(schema: graphql.type.schema.GraphQLSchema)¶ Bases:
gql.transport.async_transport.AsyncTransport
A transport for executing GraphQL queries against a local schema.
-
__init__
(schema: graphql.type.schema.GraphQLSchema)¶ Initialize the transport with the given local schema.
- Parameters
schema – Local schema as GraphQLSchema object
-
async
close
()¶ No close needed on local transport
-
async
connect
()¶ No connection needed on local transport
-
async
execute
(document: graphql.language.ast.DocumentNode, *args, **kwargs) → graphql.execution.execute.ExecutionResult¶ Execute the provided document AST for on a local GraphQL Schema.
-
subscribe
(document: graphql.language.ast.DocumentNode, *args, **kwargs) → AsyncGenerator[graphql.execution.execute.ExecutionResult, None]¶ Send a subscription and receive the results using an async generator
The results are sent as an ExecutionResult object
-