DEV Community

Daniel Seifert
Daniel Seifert

Posted on

Using GraphQL the pythonic way.

Introduction

My main task at work is to implement different interfaces, ranging from database connections to SOAP, RESTful and eventually GraphQL services.

One day whilst implementing another GraphQL service, I thought: "Hold up, why am I writing these graphql queries when i could generate them automatically?"

So I did what every programmer would do. I settled down in my basement, put every other project on hold and dove head over heels into a new project. The result? qlient. A "blazingly" fast and modern graphql client that was designed with simplicity in mind.

Installation

qlient is a pure-python module. This means that there is no C code which needs to be compiled.

This package is build with poetry so installation is as you might expect.

pip install qlient
Enter fullscreen mode Exit fullscreen mode

Usage

My goal was to make the usage as natural and intuitive as possible. It should feel like writing casual python code.

All examples use a made up http server.

Queries

Mutations

But it is not just queries you can do, mutations are supported as well:

Subscriptions

And why stop there when we can add subscriptions as well?

Conclusion

If you don't want to write the graphql queries yourself, why don't you go ahead and try out the new qlient yourself?

I am happy and open for any thoughts and feedbacks.

Top comments (0)