gqt


Namegqt JSON
Version 0.125.5 PyPI version JSON
download
home_pagehttps://github.com/eerimoq/gqt
SummaryGraphQL client in the terminal.
upload_time2024-08-29 20:36:57
maintainerNone
docs_urlNone
authorErik Moqvist
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            GraphQL client in the terminal
==============================

Build and execute GraphQL queries in the terminal.

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

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

Installation
------------

.. code-block::

   pip3 install gqt

It's recommended to install `bat`_ for pretty output.

Controls
--------

- Press ``h`` or ``?`` for help.

Examples
--------

Set default GraphQL endpoint:

.. code-block::

   export GQT_ENDPOINT=https://mys-lang.org/graphql

Interactively create a query and execute it:

.. code-block::

   gqt

.. code-block:: json

   {
       "statistics": {
           "numberOfGraphqlRequests": 3
       }
   }

Repeat last query:

.. code-block::

   gqt -r

.. code-block:: json

   {
       "statistics": {
           "numberOfGraphqlRequests": 4
       }
   }

Print the query (and variables) instead of executing it:

.. code-block::

   gqt -q

.. code-block:: graphql

   Query:
   query Query {
     statistics {
       numberOfGraphqlRequests
     }
   }

   Variables:
   {}

YAML output:

.. code-block::

   gqt -y

.. code-block:: yaml

   statistics:
     numberOfGraphqlRequests: 8

Name queries:

.. code-block::

   gqt -n stats -y

.. code-block:: yaml

   statistics:
     numberOfGraphqlRequests: 8

.. code-block::

   gqt -n time -y

.. code-block:: yaml

   standardLibrary:
     package:
       latestRelease:
         version: 0.20.0

.. code-block::

   gqt -n stats -y -r

.. code-block:: yaml

   statistics:
     numberOfGraphqlRequests: 9

.. code-block::

   gqt -n time -y -r

.. code-block:: yaml

   standardLibrary:
     package:
       latestRelease:
         version: 0.20.0

List queries:

.. code-block::

   gqt -l

.. code-block::

   Endpoint                      Query name
   ----------------------------  ------------
   https://mys-lang.org/graphql  <default>
   https://mys-lang.org/graphql  time
   https://mys-lang.org/graphql  stats

Make arguments variables by pressing ``v`` and give them as ``-v
<name>=<value>`` on the command line:

.. code-block::

   gqt -v name=time -y

.. code-block:: yaml

   standardLibrary:
     package:
       latestRelease:
         version: 0.20.0

.. code-block::

   gqt -r -q

.. code-block:: graphql

   query Query($name: String!) {
     standardLibrary {
       package(name: $name) {
         latestRelease {
           version
         }
       }
     }
   }

Print the schema:

.. code-block::

   gqt --print-schema

.. code-block:: graphql

   type Query {
     standardLibrary: StandardLibrary!
     statistics: Statistics!
     activities: [Activity!]!
   }

   type StandardLibrary {
     package(name: String!): Package!
     packages: [Package!]
     numberOfPackages: Int
     numberOfDownloads: Int
   }
   ...

Enpoint option and bearer token in HTTP auth header:

.. code-block::

   gqt -e https://api.github.com/graphql -H "Authorization: bearer ghp_<value>"

Ideas
-----

- Press ``c`` for compact view, hiding fields that are not selected.

- Search:

  Press ``/`` to search for visible fields. Press ``<Up>`` and
  ``<Down>`` to move to the previous and next search hit. Highlight
  all hits. Press ``<Enter>`` to end the search and move the cursor to
  the current hit. Press ``<Esc>`` to abort the search and restore the
  cursor to its pre-search position. Show number of hits.

  .. code-block::

     ╭─ Query
     │ ▼ search
     │   ▶ Book
     │     ■ title
     │   ▶ Author
     │     ■ name
     │ ▶ film
     │ ▶ films

     /fil                                                1 of 2 matches

- Alias?

  - Press ``a`` to create an alias.

  - Press ``d`` to delete an alias.

  ``smallPicture`` and ``mediumPicture`` are aliases of ``picture``.

  .. code-block::

     ╭─ Query
     │ ▶ Book
     │   ▶ picture
     │   ▼ smallPicture: picture
     │     ■ width: 320
     │     ■ height: 240
     │   ▼ mediumPicture: picture
     │     ■ width: 800
     │     ■ height: 600

- Optionally give schema path on command line. For endpoints that does
  not support schema introspection.

.. _bat: https://github.com/sharkdp/bat

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eerimoq/gqt",
    "name": "gqt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Erik Moqvist",
    "author_email": "erik.moqvist@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3a/97/3a2648343e405fbbd15e10a8a370c8553fb5887e894c760885c9c1eacb52/gqt-0.125.5.tar.gz",
    "platform": null,
    "description": "GraphQL client in the terminal\n==============================\n\nBuild and execute GraphQL queries in the terminal.\n\nThis project is inspired by https://graphiql-online.com.\n\n.. image:: https://github.com/eerimoq/gqt/raw/main/docs/assets/showcase.gif\n\nInstallation\n------------\n\n.. code-block::\n\n   pip3 install gqt\n\nIt's recommended to install `bat`_ for pretty output.\n\nControls\n--------\n\n- Press ``h`` or ``?`` for help.\n\nExamples\n--------\n\nSet default GraphQL endpoint:\n\n.. code-block::\n\n   export GQT_ENDPOINT=https://mys-lang.org/graphql\n\nInteractively create a query and execute it:\n\n.. code-block::\n\n   gqt\n\n.. code-block:: json\n\n   {\n       \"statistics\": {\n           \"numberOfGraphqlRequests\": 3\n       }\n   }\n\nRepeat last query:\n\n.. code-block::\n\n   gqt -r\n\n.. code-block:: json\n\n   {\n       \"statistics\": {\n           \"numberOfGraphqlRequests\": 4\n       }\n   }\n\nPrint the query (and variables) instead of executing it:\n\n.. code-block::\n\n   gqt -q\n\n.. code-block:: graphql\n\n   Query:\n   query Query {\n     statistics {\n       numberOfGraphqlRequests\n     }\n   }\n\n   Variables:\n   {}\n\nYAML output:\n\n.. code-block::\n\n   gqt -y\n\n.. code-block:: yaml\n\n   statistics:\n     numberOfGraphqlRequests: 8\n\nName queries:\n\n.. code-block::\n\n   gqt -n stats -y\n\n.. code-block:: yaml\n\n   statistics:\n     numberOfGraphqlRequests: 8\n\n.. code-block::\n\n   gqt -n time -y\n\n.. code-block:: yaml\n\n   standardLibrary:\n     package:\n       latestRelease:\n         version: 0.20.0\n\n.. code-block::\n\n   gqt -n stats -y -r\n\n.. code-block:: yaml\n\n   statistics:\n     numberOfGraphqlRequests: 9\n\n.. code-block::\n\n   gqt -n time -y -r\n\n.. code-block:: yaml\n\n   standardLibrary:\n     package:\n       latestRelease:\n         version: 0.20.0\n\nList queries:\n\n.. code-block::\n\n   gqt -l\n\n.. code-block::\n\n   Endpoint                      Query name\n   ----------------------------  ------------\n   https://mys-lang.org/graphql  <default>\n   https://mys-lang.org/graphql  time\n   https://mys-lang.org/graphql  stats\n\nMake arguments variables by pressing ``v`` and give them as ``-v\n<name>=<value>`` on the command line:\n\n.. code-block::\n\n   gqt -v name=time -y\n\n.. code-block:: yaml\n\n   standardLibrary:\n     package:\n       latestRelease:\n         version: 0.20.0\n\n.. code-block::\n\n   gqt -r -q\n\n.. code-block:: graphql\n\n   query Query($name: String!) {\n     standardLibrary {\n       package(name: $name) {\n         latestRelease {\n           version\n         }\n       }\n     }\n   }\n\nPrint the schema:\n\n.. code-block::\n\n   gqt --print-schema\n\n.. code-block:: graphql\n\n   type Query {\n     standardLibrary: StandardLibrary!\n     statistics: Statistics!\n     activities: [Activity!]!\n   }\n\n   type StandardLibrary {\n     package(name: String!): Package!\n     packages: [Package!]\n     numberOfPackages: Int\n     numberOfDownloads: Int\n   }\n   ...\n\nEnpoint option and bearer token in HTTP auth header:\n\n.. code-block::\n\n   gqt -e https://api.github.com/graphql -H \"Authorization: bearer ghp_<value>\"\n\nIdeas\n-----\n\n- Press ``c`` for compact view, hiding fields that are not selected.\n\n- Search:\n\n  Press ``/`` to search for visible fields. Press ``<Up>`` and\n  ``<Down>`` to move to the previous and next search hit. Highlight\n  all hits. Press ``<Enter>`` to end the search and move the cursor to\n  the current hit. Press ``<Esc>`` to abort the search and restore the\n  cursor to its pre-search position. Show number of hits.\n\n  .. code-block::\n\n     \u256d\u2500 Query\n     \u2502 \u25bc search\n     \u2502   \u25b6 Book\n     \u2502     \u25a0 title\n     \u2502   \u25b6 Author\n     \u2502     \u25a0 name\n     \u2502 \u25b6 film\n     \u2502 \u25b6 films\n\n     /fil                                                1 of 2 matches\n\n- Alias?\n\n  - Press ``a`` to create an alias.\n\n  - Press ``d`` to delete an alias.\n\n  ``smallPicture`` and ``mediumPicture`` are aliases of ``picture``.\n\n  .. code-block::\n\n     \u256d\u2500 Query\n     \u2502 \u25b6 Book\n     \u2502   \u25b6 picture\n     \u2502   \u25bc smallPicture: picture\n     \u2502     \u25a0 width: 320\n     \u2502     \u25a0 height: 240\n     \u2502   \u25bc mediumPicture: picture\n     \u2502     \u25a0 width: 800\n     \u2502     \u25a0 height: 600\n\n- Optionally give schema path on command line. For endpoints that does\n  not support schema introspection.\n\n.. _bat: https://github.com/sharkdp/bat\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "GraphQL client in the terminal.",
    "version": "0.125.5",
    "project_urls": {
        "Homepage": "https://github.com/eerimoq/gqt"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fc500324d64dcf040ce46e7338cb0c98e34a1c74190114694dccf6cdf8db03e",
                "md5": "a292a519f505c19e0f035921d23b433b",
                "sha256": "fb10a4f1da40196161810cbd89072bf2c0879be4b40c9e95b686fb1845e97f0d"
            },
            "downloads": -1,
            "filename": "gqt-0.125.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a292a519f505c19e0f035921d23b433b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17912,
            "upload_time": "2024-08-29T20:36:56",
            "upload_time_iso_8601": "2024-08-29T20:36:56.510526Z",
            "url": "https://files.pythonhosted.org/packages/2f/c5/00324d64dcf040ce46e7338cb0c98e34a1c74190114694dccf6cdf8db03e/gqt-0.125.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a973a2648343e405fbbd15e10a8a370c8553fb5887e894c760885c9c1eacb52",
                "md5": "32d86ee2ad73ffb86fa61ad7edf59441",
                "sha256": "518923dca538e992bbf52c4afbed0acfa9147de8e2efdb22fe625476f60d836c"
            },
            "downloads": -1,
            "filename": "gqt-0.125.5.tar.gz",
            "has_sig": false,
            "md5_digest": "32d86ee2ad73ffb86fa61ad7edf59441",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22424,
            "upload_time": "2024-08-29T20:36:57",
            "upload_time_iso_8601": "2024-08-29T20:36:57.740636Z",
            "url": "https://files.pythonhosted.org/packages/3a/97/3a2648343e405fbbd15e10a8a370c8553fb5887e894c760885c9c1eacb52/gqt-0.125.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 20:36:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eerimoq",
    "github_project": "gqt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "gqt"
}
        
Elapsed time: 0.90666s