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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Erik Moqvist",
"author_email": "erik.moqvist@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8a/eb/c476c54e542adca3a18d3510b4195812f3b37c0a91a472d9a5c02c2ccf69/gqt-0.125.4.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.4",
"project_urls": {
"Homepage": "https://github.com/eerimoq/gqt"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "01bdb5fa4be270fdbe954871f2814c5234a6aadfd0990af98fe985131498b822",
"md5": "4d9f10e79d9875e8c66af5dd29d52636",
"sha256": "68e44075c362f97f4bce0a5816ba0bd4f66f8d066302bf6903d7d230ef03f10b"
},
"downloads": -1,
"filename": "gqt-0.125.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4d9f10e79d9875e8c66af5dd29d52636",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 17907,
"upload_time": "2023-09-15T16:51:06",
"upload_time_iso_8601": "2023-09-15T16:51:06.326269Z",
"url": "https://files.pythonhosted.org/packages/01/bd/b5fa4be270fdbe954871f2814c5234a6aadfd0990af98fe985131498b822/gqt-0.125.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8aebc476c54e542adca3a18d3510b4195812f3b37c0a91a472d9a5c02c2ccf69",
"md5": "218d5781850517b5b18547d75693b578",
"sha256": "b379f11895d1da09ca14a55f6ae33863d30a85aedd8544415553430a01695795"
},
"downloads": -1,
"filename": "gqt-0.125.4.tar.gz",
"has_sig": false,
"md5_digest": "218d5781850517b5b18547d75693b578",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22416,
"upload_time": "2023-09-15T16:51:07",
"upload_time_iso_8601": "2023-09-15T16:51:07.843256Z",
"url": "https://files.pythonhosted.org/packages/8a/eb/c476c54e542adca3a18d3510b4195812f3b37c0a91a472d9a5c02c2ccf69/gqt-0.125.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-15 16:51:07",
"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"
}