Pythonic GraphQL client
Project description
GraphQL
Django queryset love
__getattr__ abuse
???
Profit!!!
What
py2graphql is a Python GraphQL client that makes GraphQL feel better to use. It almost feels like you’re using Django’s ORM.
Example
This Python equates to the following GraphQL.
from py2graphql import Query
Query().repository(owner='juliuscaeser', name='rome').pullRequest(number=2).values('title', 'url').commits(last=250).edges.node.commit.values('id', 'message', 'messageBody')
query {
repository(owner: "juliuscaeser", name: "rome") {
pullRequest(number: 2) {
title
url
commits(last: 250) {
edges {
node {
commit {
id
message
messageBody
}
}
}
}
}
}
}
You can even use the library to do the HTTP requests:
from py2graphql import Client
headers = {
'Authorization': 'token MY_TOKEN',
}
Client(url=THE_URL, headers=headers).query().repository(owner='juliuscaeser', name='rome').fetch()
Installation
pip install py2graphql
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py2graphql-0.1.0.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for py2graphql-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9372fb9a6882575ba7f239d15429a7d4c48a583aed85c53bf302064f61f3c99 |
|
MD5 | c8e41242fa8e0695dbf9fb0f5cbabaf7 |
|
BLAKE2b-256 | 9dcc3790adcf8b57038f810b898adafcbb89c87461dd699b16f9dbb2db7f5c08 |