Skip to content
GraphQL parser for Python
Branch: master
Clone or download
Latest commit e528b46 Jun 23, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
graphql_parser Fix transforms Jun 23, 2015
tests Fix style Jun 23, 2015
.gitignore
.travis.yml Add .travis.yml Jun 23, 2015
README.md
requirements.txt Add requirements file Jun 17, 2015
setup.py

README.md

graphql-parser

Build Status

This is a Python parser for React's GraphQL.

Lacking a specification, the parser was built to parse code along the lines of examples and other implementations of GraphQL.

Usage

from graphql_parser import parse

QUERY = '''{
  user(1) {
    name,
    email,
    profile_pic.size(64) {
      date_added
    }
  }
}
'''

parse(QUERY)

Produces:

{
  'type': 'block',
  'children': [
    {
      'type': 'call',
      'chain': ['user'],
      'arguments': ['1'],
      'body': {
        'type': 'block',
        'children': [
          'name',
          'email',
          {
            'type': 'call',
            'chain': ['profile_pic', 'size'],
            'arguments': ['64'],
            'body': {
              'type': 'block',
              'children': ['date_added']
            },
          }
        ]
      }
    }
  ]
}

License

Copyright (c) 2015 Tryolabs SRL.

Released under the MIT license.

You can’t perform that action at this time.