GraphQL
This module exposes the GraphQL
class, which provides an entrypoint into querying GraphQL resources.
Check-out its attributes and methods to
learn more on what you can do with it!
GraphQL
- class nops_sdk.graphql.graphql.GraphQL(query)
Bases:
object
Designates a GraphQL query handler
- __init__(query)
- Parameters
query – the graphql query to be executed on the nOps database
- get_query_result()
Get results for a given query
- Returns
Raw object response of the executed query
- Return type
dict[str, typing.Any]
Examples
>>> from nops_sdk.graphql import GraphQL >>> query = "query MyS3Buckets { s3_buckets(limit: 2) { name } }" >>> graphql = GraphQL(query=query) >>> result = graphql.get_query_result() { 's3_buckets': [ {'name': 'x-client-009-account'}, {'name': 'x-client-009-account-001'} ] }