{"id":21974060,"url":"https://github.com/akornatskyy/asgi-cli","last_synced_at":"2026-03-08T16:01:37.081Z","repository":{"id":38022948,"uuid":"284270180","full_name":"akornatskyy/asgi-cli","owner":"akornatskyy","description":":sparkles: Call ASGI Python application from command line, just like CURL.","archived":false,"fork":false,"pushed_at":"2025-04-27T04:54:26.000Z","size":53,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-27T05:29:30.946Z","etag":null,"topics":["asgi","bench","cli","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akornatskyy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-08-01T13:57:28.000Z","updated_at":"2025-04-27T04:54:29.000Z","dependencies_parsed_at":"2023-11-08T13:38:54.474Z","dependency_job_id":"abef2b26-6e03-425e-96fc-df86d796dd20","html_url":"https://github.com/akornatskyy/asgi-cli","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"0bce11fc2ea84f5b318eb3bcb65975924d3a95a8"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akornatskyy%2Fasgi-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akornatskyy%2Fasgi-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akornatskyy%2Fasgi-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akornatskyy%2Fasgi-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akornatskyy","download_url":"https://codeload.github.com/akornatskyy/asgi-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251094583,"owners_count":21535324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","bench","cli","python"],"created_at":"2024-11-29T15:37:24.954Z","updated_at":"2026-03-08T16:01:37.072Z","avatar_url":"https://github.com/akornatskyy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASGI CLI\n\n![tests](https://github.com/akornatskyy/asgi-cli/workflows/tests/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/akornatskyy/asgi-cli/badge.svg?branch=master)](https://coveralls.io/github/akornatskyy/asgi-cli?branch=master)\n[![pypi version](https://badge.fury.io/py/asgi-cli.svg)](https://badge.fury.io/py/asgi-cli)\n\nCall [ASGI](https://asgi.readthedocs.io/en/latest/index.html)\nPython application from command line, just like CURL.\n\nIf you’re using this tool, **★Star** this repository to show your interest, please!\n\n## Install\n\n```sh\npip install -U asgi-cli\n```\n\n## Usage\n\n```sh\nasgi-cli --help\n```\n\n```text\nusage: asgi_cli [-h] [-V] [--app-dir APP_DIR] [-X METHOD] [-H HEADER]\n                [-d DATA | -F MULTIPART] [-I | -b | -p | -v]\n                [--root-path ROOT_PATH] [-n NUMBER]\n                app [url]\n\npositional arguments:\n  app                   an application module\n  url                   a uniform resource locator or path (default /)\n\noptions:\n  -h, --help            show this help message and exit\n  -V, --version         show program's version number and exit\n  --app-dir APP_DIR     look for APP in the specified directory, by adding this to the PYTHONPATH\n  -X, --request METHOD  specify request method to use, e.g. POST (default GET)\n  -H, --header HEADER   pass custom header line, e.g. -H='Accept: application/json'\n  -d, --data DATA       request body data, e.g. '{\"msg\":\"hello\"}', 'msg=hello'\n  -F, --form MULTIPART  specify HTTP multipart POST data, e.g. name=value or name=@file\n  -I, --head            show status and headers only\n  --root-path ROOT_PATH\n                        set the ASGI 'root_path'\n  -b, --benchmark       issue a number of requests through repeated iterations (reports\n                        throughtput and average call time)\n  -p, --profile         prints out a report of top 10 functions ordered by internal time, saves to\n                        'stats.cprof' file\n  -n NUMBER             a number of requests to issue (default 100K)\n  -v, --verbose         make the operation more talkative\n```\n\n## Examples\n\n_example.py_:\n\n```python\nSTART = {\n    \"type\": \"http.response.start\",\n    \"status\": 200,\n    \"headers\": [\n        (b\"content-length\", b\"13\"),\n        (b\"content-type\", b\"text/html; charset=utf-8\"),\n    ],\n}\n\nBODY1 = {\"type\": \"http.response.body\", \"body\": b\"Hello\"}\nBODY2 = {\"type\": \"http.response.body\", \"body\": b\", world!\"}\n\n\nasync def app(scope, receive, send) -\u003e None:\n    await send(START)\n    await send(BODY1)\n    await send(BODY2)\n```\n\nThen run the examples:\n\n`asgi-cli example:app` prints response body:\n\n```text\nHello, world!\n```\n\n`asgi-cli -v example:app` pretty prints scope and sent messages:\n\n```text\n{'scope': {'asgi': {'spec_version': '2.1', 'version': '3.0'},\n           'client': ('127.0.0.1', 49327),\n           'headers': [(b'accept', b'*/*'),\n                       (b'user-agent', b'asgi-cli/0.0.1'),\n                       (b'host', b'127.0.0.1:8000')],\n           'http_version': '1.1',\n           'method': 'GET',\n           'path': '/',\n           'query_string': b'',\n           'raw_path': b'/',\n           'root_path': '',\n           'scheme': 'http',\n           'server': ('127.0.0.1', 8000),\n           'type': 'http'}}\n{'message': {'headers': [(b'content-length', b'13'),\n                         (b'content-type', b'text/html; charset=utf-8')],\n             'status': 200,\n             'type': 'http.response.start'}}\n{'message': {'body': b'Hello', 'type': 'http.response.body'}}\n{'message': {'body': b', world!', 'type': 'http.response.body'}}\n```\n\n`asgi-cli -b example:app` shows execution stats (runs in 3 iterations, for each iteration displays requests per second and an average call time):\n\n```text\n #1 =\u003e 477.74K, 2.09μs\n #2 =\u003e 438.12K, 2.28μs\n #3 =\u003e 446.90K, 2.24μs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakornatskyy%2Fasgi-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakornatskyy%2Fasgi-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakornatskyy%2Fasgi-cli/lists"}