Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evenstar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evenstar

A GraphQL query builder

  • 0.2
  • PyPI
  • Socket score

Maintainers
1

Evenstar

Just another GraphQL query builder, but composable!

How to install it?

It's simple, just run: pip install evenstar

GraphQL Syntax Coverage

  • Fields
  • Arguments
  • Aliases
  • Fragments
  • Operation Name
  • Variables
  • Directives
  • Mutations
  • Inline Fragments

Example

apple_field = Field(
    name="appleMutation",
    alias="apple_mutation_alias",
    arguments=Arguments(
        {"input": VarSymbol("$apple_input")}
    ),
    children=[
        "__typename",
        InlineFragment(
            on="SomeErrKind",
            children=["code", "field", "message"]
        ),
        InlineFragment(
            on="SomeAnotherErrKind",
            children=["error_code"]
        ),
    ],
)

create_banana_field = Field(
    name="createBanana",
    alias="create_banana",
    arguments=Arguments(
        {"input": VarSymbol("$create_banana_input")}
    ),
    children=[
        "__typename",
        "code",
        InlineFragment(
            on="SomeAnotherErrKind",
            children=["error_code"]
        ),
        InlineFragment(
            on="Banana",
            children=[
                "id",
                "quality",
                Field(
                    "farm",
                    children=[
                        "country",
                        "town",
                        "number",
                    ],
                ),
            ],
        ),
    ],
)

gql_req = Request(
    children=[
        Mutation(
            children=[create_banana_field, apple_field],
            variables=[
                VarDeclaration("$apple_input", "CreateAppleInput!"),
                VarDeclaration("$banana_input", "CreateBananaInput!"),
            ],
        )
    ],
    variables={
        "apple_input": {"id": str(uuid4())},
        "banana_input": {"id": str(uuid4())},
    },
)

print(gql_req.json(indent=2))

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc