How to use the schema.schema function in schema

To help you get started, we’ve selected a few schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codexlynx / osquery-graphene / test_all.py View on Github external
def test_graphene():
    client = Client(schema.schema)
    executed = client.execute('{ test }')
    assert executed == {
        'data': {
            'test': 'test'
        }
github andela / mrm_api / tests / base.py View on Github external
def create_app(self):
        app = create_app('testing')
        self.base_url = 'https://127.0.0.1:5000/mrm'
        self.headers = {'content-type': 'application/json'}
        self.client = Client(schema)
        return app
github mediatum / mediatum / schema / bibtex.py View on Github external
def getbibtexmappings():
    bibtextypes = {}
    for metatype in schema.loadTypesFromDB():
        for bibtextype in metatype.get("bibtexmapping").split(";"):
            if bibtextype:
                metatype_name = metatype.getName()
                bibtextypes[bibtextype] = bibtextypes.get(bibtextype, []) + [metatype_name]
    for bibtextype in bibtextypes:
        if len(bibtextypes[bibtextype]) == 1:
            bibtextypes[bibtextype] = bibtextypes[bibtextype][-1]
        elif len(bibtextypes[bibtextype]) > 1:
            logg.error("bibtex import: ambiguous mapping for bibtex type '%s': %s - choosing last one",
                bibtextype, bibtextypes[bibtextype])
            bibtextypes[bibtextype] = bibtextypes[bibtextype][-1]
    return bibtextypes
github mediatum / mediatum / core / init.py View on Github external
def init_modules():
    """init modules with own init function"""
    from export import oaisets
    if config.getboolean("oai.activate", False):
        oaisets.init()

    from export import exportutils
    exportutils.init()
    from schema import schema
    schema.init()
    from core import xmlnode
#     xmlnode.init()
    from core import auth
    auth.init()
    from export import exportutils
    exportutils.init()
github syrusakbary / gdom / gdom / cmd.py View on Github external
def get_test_app():
    app = Flask(__name__)
    app.debug = True

    app.add_url_rule('/graphql', 'graphql', view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True))
    app.add_url_rule('/', 'index', view_func=index_view,)
    return app
github syrusakbary / gdom / gdom / cmd.py View on Github external
def parse(query, source, page):
    execution = schema.execute(query, args={'page': page, 'source': source})
    if execution.errors:
        raise Exception(execution.errors[0])
    return execution.data
github mediatum / mediatum / bin / mediatumipython.py View on Github external
def check_masks_of_mdt(mdt):
                for mask in mdt.masks:
                    print("-" * 80)
                    print(u"checking mask {} of mdt {}".format(mask.name, mdt.name))
                    metadatatypes.checkMask(mask, fix=args.fix, verbose=1, show_unused=1)
github kubos / kubos-old / demo / payload / app.py View on Github external
app.add_url_rule(
        '/',
        view_func=GraphQLView.as_view(
            'graphql',
            schema=schema,
            graphiql=False
        )
    )


    app.add_url_rule(
        '/graphiql',
        view_func=GraphQLView.as_view(
            'graphiql',
            schema=schema,
            graphiql=True
        )
    )

    return app
github alexisrolland / flask-graphene-sqlalchemy / example / api.py View on Github external
from database.base import db_session
from flask import Flask
from flask_graphql import GraphQLView
from schema import schema

app = Flask(__name__)
app.add_url_rule(
    '/graphql',
    view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True))


@app.teardown_appcontext
def shutdown_session(exception=None):
    db_session.remove()


if __name__ == '__main__':
    app.run(threaded=True, debug=True)
github graphql-python / graphql-ws / examples / aiohttp / app.py View on Github external
async def graphql_view(request):
    payload = await request.json()
    response = await schema.execute(payload.get('query', ''), return_promise=True)
    data = {}
    if response.errors:
        data['errors'] = [format_error(e) for e in response.errors]
    if response.data:
        data['data'] = response.data
    jsondata = json.dumps(data,)
    return web.Response(text=jsondata, headers={'Content-Type': 'application/json'})