🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

graphql-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-api

A framework for building Python GraphQL APIs.

1.3.30
PyPI
Maintainers
1

GraphQL API

Framework for building a GraphQL API with Python

coverage report

pipeline status

Installation

Pip
pip install graphql-api

Run the Unit Tests

To run the tests.

pip install pipenv
pipenv install --dev
pipenv run python -m pytest tests --cov=graphql_api

Docs

The documentation is public, and is generated using Sphinx.

GraphQL-API Documentation

Build documentation

To build a local static HTML version of the documentation.

pip install pipenv
pipenv install sphinx
pipenv run sphinx-build docs ./public -b html

Simple Example

from graphql_api import GraphQLAPI

api = GraphQLAPI()

@api.type(is_root_type=True)
class MathService:

    @api.field
    def is_odd(self, number: int) -> str:
        return "No" if (num % 2) else "Yes"


query = '''
    query {
        isOdd(number: 5)
    }
'''

result = api.executor().execute(query)

print(result.data)
$ python example.py
>>> {'isOdd': 'No'}

Keywords

GraphQL

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