Skip to content
Simple GraphQL client for Python 2.7+
Python
Branch: master
Clone or download
Latest commit 7eecc87 Jul 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
graphqlclient fix bug due to missing set of self.headername Jun 22, 2018
.gitignore release initial version May 12, 2016
LICENSE Initial commit May 12, 2016
MANIFEST.in fix build issue by adding MANIFEST.in Jul 12, 2018
README.md fix build issue by adding MANIFEST.in Jul 12, 2018
example_run.py fix client error May 12, 2016
setup.py increment setup.py Jul 12, 2018

README.md

python-graphql-client

Simple GraphQL client for Python 2.7+

Install

pip install graphqlclient

Usage

from graphqlclient import GraphQLClient

client = GraphQLClient('http://graphql-swapi.parseapp.com/')

result = client.execute('''
{
  allFilms {
    films {
      title
    }
  }
}
''')

print(result)

Authorization

Authorization tokens can be added to the request using the client's inject_token method:

client.inject_token('very-long-and-secure-token')

which defaults to http header name Authorization. An alternative http header name for the token can be set by passing in the alternative header name, e.g. for x-api-key:

client.inject_token('very-long-and-secure-token','x-api-key')

License

MIT License

You can’t perform that action at this time.