Skip to content

Conversation

@BharathaAravind
Copy link
Contributor

@BharathaAravind BharathaAravind commented Mar 27, 2019

A Basic Http Client to support Query and Mutations over http.

Sample Query Usage:

from  graphql_client import GraphQLHttpClient

httpClient = GraphQLHttpClient.GraphQLHttpClient("http://localhost:8080/graphql")
q = """
  query ($limit: Int!) {
    notifications (order_by: {created: "desc"}, limit: $limit) {
      id
      title
      content
    }
  }
"""
response = httpClient.query(query=q, variables={'limit': 10})
print(response.text)

Even the mutation works the same way. It internally calls query itself.

from  graphql_client import GraphQLHttpClient
httpClient = GraphQLHttpClient.GraphQLHttpClient("http://localhost:8080/graphql")
mutation = """
  mutation{
    uploadData(file:"xxx/somefilepath.txt"){
    id
  }
}
"""
response = httpClient.mutation(query=mutation)

@ecthiender
Copy link
Owner

There should be one client which can use a specified transport (HTTP or websocket). Closing this in favour of a better design in #17 .

Thanks for all your work @BharathaAravind . Please feel free to contribute anything else, if you would like.

@ecthiender ecthiender closed this Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants