Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tryolabs/graphql-parser
GraphQL parser for Python
https://github.com/tryolabs/graphql-parser
Last synced: about 1 month ago
JSON representation
GraphQL parser for Python
- Host: GitHub
- URL: https://github.com/tryolabs/graphql-parser
- Owner: tryolabs
- Created: 2015-06-23T17:40:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-23T19:02:08.000Z (over 9 years ago)
- Last Synced: 2024-08-01T22:50:58.698Z (4 months ago)
- Language: Python
- Homepage:
- Size: 108 KB
- Stars: 48
- Watchers: 8
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-graphql - graphql-parser - GraphQL parser for Python. (Libraries / Python Libraries)
- awesome-graphql - graphql-parser - GraphQL parser for Python. (Libraries / Python Libraries)
README
# graphql-parser
[![Build Status](https://travis-ci.org/tryolabs/graphql-parser.svg?branch=master)](https://travis-ci.org/tryolabs/graphql-parser)
This is a Python parser for [React's][react] [GraphQL][graphql].
Lacking a specification, the parser was built to parse code along the lines of
examples and other implementations of GraphQL.# Usage
```python
from graphql_parser import parseQUERY = '''{
user(1) {
name,
email,
profile_pic.size(64) {
date_added
}
}
}
'''parse(QUERY)
```Produces:
```python
{
'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][tryo] SRL.
Released under the MIT license.
[react]: http://facebook.github.io/react/
[graphql]: https://facebook.github.io/react/blog/2015/05/01/graphql-introduction.html
[tryo]: http://tryolabs.com/