All Projects → prodigyeducation → python-graphql-client

prodigyeducation / python-graphql-client

Licence: MIT license
Simple module for making requests to a graphQL server in python.

Programming Languages

python
139335 projects - #7 most used programming language
POV-Ray SDL
72 projects
Makefile
30231 projects
pascal
1382 projects

Projects that are alternatives of or similar to python-graphql-client

Graphql.js
A Simple and Isomorphic GraphQL Client for JavaScript
Stars: ✭ 2,206 (+3293.85%)
Mutual labels:  graphql-client
DotNetGraphQL
A sample demonstrating how to create a GraphQL Backend in .NET and consume it from a .NET mobile app created using Xamarin
Stars: ✭ 78 (+20%)
Mutual labels:  graphql-client
vue-gql
A small and fast GraphQL client for Vue.js
Stars: ✭ 32 (-50.77%)
Mutual labels:  graphql-client
36 Graphql Concepts
📜 36 concepts every GraphQL developer should know.
Stars: ✭ 209 (+221.54%)
Mutual labels:  graphql-client
Neuron
A GraphQL client for Elixir
Stars: ✭ 244 (+275.38%)
Mutual labels:  graphql-client
artemis
Ruby GraphQL client on Rails that actually makes you more productive
Stars: ✭ 149 (+129.23%)
Mutual labels:  graphql-client
Gqlify
[NOT MAINTAINED]An API integration framework using GraphQL
Stars: ✭ 182 (+180%)
Mutual labels:  graphql-client
protoc-gen-twirpql
Generate A GraphQL Layer from A Twirp Server: https://twirpql.dev
Stars: ✭ 49 (-24.62%)
Mutual labels:  graphql-client
Apollo Android
🤖  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
Stars: ✭ 2,949 (+4436.92%)
Mutual labels:  graphql-client
galoy-pay
A web application that can be used to send tips or payments to users
Stars: ✭ 21 (-67.69%)
Mutual labels:  graphql-client
Plugin Graphql
Vuex ORM persistence plugin to sync the store against a GraphQL API.
Stars: ✭ 215 (+230.77%)
Mutual labels:  graphql-client
Productivity Frontend
Productivity Application - Kanban Style Productivity Management Application with Customizable Boards, Lists and Cards to Make You More Productive.
Stars: ✭ 234 (+260%)
Mutual labels:  graphql-client
StarWars
Minimal GraphQL based Jetpack Compose, Wear Compose and SwiftUI Kotlin Multiplatform sample (using StarWars endpoint - https://graphql.org/swapi-graphql)
Stars: ✭ 165 (+153.85%)
Mutual labels:  graphql-client
Reason Urql
Reason bindings for Formidable's Universal React Query Library, urql.
Stars: ✭ 203 (+212.31%)
Mutual labels:  graphql-client
character-overlay
Web App for adding an OBS overlay with character information such as name, picture, and health for your favorite role-playing game.
Stars: ✭ 17 (-73.85%)
Mutual labels:  graphql-client
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+4529.23%)
Mutual labels:  graphql-client
gatsby-starter-redux-saas
An Gatsby starter for Saas products. Uses redux and apollo and a graphql token auth backend.
Stars: ✭ 18 (-72.31%)
Mutual labels:  graphql-client
nim-graphql
Nim implementation of GraphQL with sugar and steroids
Stars: ✭ 47 (-27.69%)
Mutual labels:  graphql-client
showcase
A Full Stack Journey with Micro Services and Micro Front Ends. Using dapr, kubernetes, react module federation and web assembly,
Stars: ✭ 45 (-30.77%)
Mutual labels:  graphql-client
flutter-graphql
A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package. Built after react apollo
Stars: ✭ 45 (-30.77%)
Mutual labels:  graphql-client

Code style: black Python CI Checks Upload Python Package

Python GraphQL Client

Simple package for making requests to a graphql server.

Installation

pip install python-graphql-client

Usage

Queries & Mutations

from python_graphql_client import GraphqlClient

# Instantiate the client with an endpoint.
client = GraphqlClient(endpoint="https://countries.trevorblades.com")

# Create the query string and variables required for the request.
query = """
    query countryQuery($countryCode: String) {
        country(code:$countryCode) {
            code
            name
        }
    }
"""
variables = {"countryCode": "CA"}

# Synchronous request
data = client.execute(query=query, variables=variables)
print(data)  # => {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}


# Asynchronous request
import asyncio

data = asyncio.run(client.execute_async(query=query, variables=variables))
print(data)  # => {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}

Subscriptions

from python_graphql_client import GraphqlClient

# Instantiate the client with a websocket endpoint.
client = GraphqlClient(endpoint="wss://www.your-api.com/graphql")

# Create the query string and variables required for the request.
query = """
    subscription onMessageAdded {
        messageAdded
    }
"""

# Asynchronous request
import asyncio

asyncio.run(client.subscribe(query=query, handle=print))
# => {'data': {'messageAdded': 'Error omnis quis.'}}
# => {'data': {'messageAdded': 'Enim asperiores omnis.'}}
# => {'data': {'messageAdded': 'Unde ullam consequatur quam eius vel.'}}
# ...

Advanced Usage

Disable SSL verification

Set the keyword argument verify=False ether when instantiating the GraphqlClient class.

from python_graphql_client import GraphqlClient

client = GraphqlClient(endpoint="wss://www.your-api.com/graphql", verify=False)

Alternatively, you can set it when calling the execute method.

from python_graphql_client import GraphqlClient

client = GraphqlClient(endpoint="wss://www.your-api.com/graphql"
client.execute(query="<Your Query>", verify=False)

Custom Authentication

from requests.auth import HTTPBasicAuth
from python_graphql_client import GraphqlClient

auth = HTTPBasicAuth('[email protected]', 'not_a_real_password')
client = GraphqlClient(endpoint="wss://www.your-api.com/graphql", auth=auth)

Custom Headers

from python_graphql_client import GraphqlClient

headers = { "Authorization": "Token SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV" }
client = GraphqlClient(endpoint="wss://www.your-api.com/graphql", headers=headers)

Roadmap

To start we'll try and use a Github project board for listing current work and updating priorities of upcoming features.

Contributing

Read the Contributing documentation for details on the process for submitting pull requests to the project. Also take a peek at our Code of Conduct.

Authors and Acknowledgement

Kudos to @xkludge, @DaleSeo, and @mattbullock for getting this project started.

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].