a file-based rest api client
Project description
athena
athena is a file-based rest api client.
$ pip install haondt-athena
$ athena init
$ cat << EOF > athena/hello.py
from athena.client import Athena
def run(athena: Athena):
client = athena.client()
client.get('http://echo.jsontest.com/key/value')
EOF
$ athena responses athena/hello.py
hello •
│ execution
│ │ environment: __default__
│
│ timings
│ │ http://echo...m/key/value ························ 470ms
│
│ traces
│ │ http://echo.jsontest.com/key/value
│ │ │ │ GET http://echo.jsontest.com/key/value
│ │ │ │ 200 OK 470ms
│ │ │
│ │ │ response
│ │ │ │ headers
│ │ │ │ │ Access-Control-Allow-Origin | *
│ │ │ │ │ Content-Type | application/json
│ │ │ │ │ X-Cloud-Trace-Context | 35b9c247eaaa4175c1949b97dd13548a
│ │ │ │ │ Date | Fri, 05 Jul 2024 20:33:16 GMT
│ │ │ │ │ Server | Google Frontend
│ │ │ │ │ Content-Length | 17
│ │ │ │
│ │ │ │ body | application/json [json] 17B
│ │ │ │ │ 1 {
│ │ │ │ │ 2 "key": "value"
│ │ │ │ │ 3 }
│ │ │ │ │
│ │ │ │
│ │ │
│ │
│
athena provides a lightweight alternative to full-blown api platforms like Postman with a few key advantages:
- You are free to use any text editor you would like as the api client. Lightweight editors like Neovim or VSCode allow for a much thinner client.
- As the workbook is just a collection of plaintext files, you can keep it in the same git repo as the project it is testing.
- Since requests are just python modules, you can script to your hearts content, and leverage external python libraries.
Installation
athena can be installed as a pypi package or from source. athena requires python>=3.14.
# from pypi
python3 -m pip install haondt-athena
# from gitlab
python3 -m pip install haondt-athena --index-url https://gitlab.com/api/v4/projects/57154225/packages/pypi/simple
# from source
git clone https://gitlab.com/haondt/athena.git
python3 -m pip install .
Usage
Quickstart guide and API / CLI reference available here: https://docs.haondt.dev/athena/
Development
Setting up dev env
Ensure you have just installed, and run
just install
Running Tests
How to run the E2E tests
- build docker images for the api echo server and for the test runner images
./tests/e2e/build_dockerfile.sh
- start both images to run the tests
./tests/e2e/run_tests.sh
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file haondt_athena-5.1.1.tar.gz.
File metadata
- Download URL: haondt_athena-5.1.1.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8b11a89ea94817cecb42fe28477f78c9ffc87b4238e6b64dc55acf6d6ffa881
|
|
| MD5 |
1146d6dd49ca42389a656716b5097e37
|
|
| BLAKE2b-256 |
3bfd20c61e1f1ea2fb7d0e82bf423b9be5df914296de2277c1b169cd5bb7e12f
|
File details
Details for the file haondt_athena-5.1.1-py3-none-any.whl.
File metadata
- Download URL: haondt_athena-5.1.1-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc7db0ed49796950a0e5bf4fa789300122656155b2a30a9ffbd7ddd6d7088dd1
|
|
| MD5 |
1c82bedb86fc1f4e6772b115e2f2001a
|
|
| BLAKE2b-256 |
9ab58e3574bc84cc0eb69c0df295fa11c9808825502724532708805c666fc640
|