Skip to main content

GraphQL client in the terminal.

Project description

This project is inspired by https://graphiql-online.com.

https://github.com/eerimoq/gqt/raw/main/docs/assets/showcase.gif

Installation

$ pip3 install gqt

Usage

Set default GraphQL end-point URL:

$ export GQT_URL=https://mys-lang.org/graphql

Interactively create a query and execute it:

$ gqt
{"statistics": {"number_of_graphql_requests": 234}}

Repeat last query:

$ gqt -r
{"statistics": {"number_of_graphql_requests": 235}}

Print the query instead of executing it:

$ gqt -q
{"query":"{statistics {number_of_graphql_requests}}"}

Use jq for indentation, colors and extracting field values:

$ gqt | jq
{
  "statistics": {
    "number_of_graphql_requests": 236
  }
}
$ gqt | jq .statistics.number_of_graphql_requests
237

Use YAML output and bat for indentation and colors:

$ gqt -y | bat -l yaml -pP
statistics:
  number_of_graphql_requests: 238

Ideas

  • Mutations?

  • Subscriptions?

  • Arguments and variables:

    ■: not null
    □: null
    $: variable

    Scalar example:

    ╭─ Query
    │ ▼ standard_library
    │   ▼ package
    │     ■ name: ""
    │     □ name
    │   ▶ packages

    List example:

    ╭─ Query
    │ ▼ item
    │   □ kinds:
    │   ■ kinds2:
    │     [0] ■ a: "foo"
    │         ■ b: "eq"
    │         ■ c:
    │           [0] ■ a: "x"
    │               ■ b: "y"
    │           [1]
    │     [1] ■ a: "bar"
    │         ■ b: "ne"
    │         □ c:
    │     [2]

    Variables example:

    ╭─ Query
    │ ▼ standard_library
    │   ▼ package
    │     $ name: name
    │     ■ id: 5
    │     $ kind: kind
    │     □ name
    │   □ number_of_downloads
    │ ▶ statistics
    
    ╭─ Variables
    │ name: "foo"
    │ kind:
    │   [0] ■ a: "bar"
    │       ■ b: "ne"
    │       □ c:
    │   [1]

    Print the variables:

    $ gqt -v
    {"name": "foo", "kind": [{"a": "bar", "b": "ne"}]}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gqt-0.36.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

gqt-0.36.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file gqt-0.36.0.tar.gz.

File metadata

  • Download URL: gqt-0.36.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gqt-0.36.0.tar.gz
Algorithm Hash digest
SHA256 0462868b78ff9eb01201cc409455843b9bf5133f295cf09e250ae47ff9ca455e
MD5 e24b4208fc67374ea991789d4011e3d0
BLAKE2b-256 23fb5ac0ec59750625b8b15d28759b0a8cc5c06256294ae55e33f6d485c6c737

See more details on using hashes here.

File details

Details for the file gqt-0.36.0-py3-none-any.whl.

File metadata

  • Download URL: gqt-0.36.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gqt-0.36.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdad0e28e36dbf16c07015eb8f2448c3784d03397debf22f798af4aca0f3570c
MD5 5a4017e1759d4be8dfae9ee70bdd74f4
BLAKE2b-256 fc03b1f2345e6be90d8a59ffbed74e0f126df30d60417bd62e3d89545c7bc9f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page