Simple GraphQL client for Python 2.7+
Project description
# python-graphql-client
Simple GraphQL client for Python 2.7+
## Install
```sh
pip install graphqlclient
```
## Usage
```py
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:
```py
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':
```py
client.inject_token('very-long-and-secure-token','x-api-key')
```
## License
[MIT License](http://opensource.org/licenses/MIT)
Simple GraphQL client for Python 2.7+
## Install
```sh
pip install graphqlclient
```
## Usage
```py
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:
```py
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':
```py
client.inject_token('very-long-and-secure-token','x-api-key')
```
## License
[MIT License](http://opensource.org/licenses/MIT)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graphqlclient-0.2.2.tar.gz
(1.7 kB
view details)
File details
Details for the file graphqlclient-0.2.2.tar.gz
.
File metadata
- Download URL: graphqlclient-0.2.2.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99074e23e9ca5b94e7a8c5db395683b66ec05ddb136f9ceb497853f9f443ab45 |
|
MD5 | 67dabd6b0de12a9f66ee85b3ec4cabd6 |
|
BLAKE2b-256 | daf2b7def3fc54965b178eeb9c7fb82209f135d135c672e610b8c432e0e28e7f |