|
1 | | -.. |
| 1 | +.. |
2 | 2 | SPDX-FileCopyrightText: 2020 Birger Schacht |
3 | 3 | SPDX-License-Identifier: AGPL-3.0-or-later |
4 | 4 |
|
5 | 5 | ########### |
6 | 6 | intelmq-api |
7 | 7 | ########### |
8 | 8 |
|
9 | | -|Build Status| |
| 9 | +|Tests Status| |Package Status| |
10 | 10 |
|
11 | | -.. |Build Status| image:: https://travis-ci.com/certtools/intelmq-api.svg?branch=develop |
12 | | - :target: https://travis-ci.com/certtools/intelmq-api |
| 11 | +.. |Tests Status| image:: https://github.com/certtools/intelmq-api/actions/workflows/python-unittests.yml/badge.svg |
| 12 | + :target: https://github.com/certtools/intelmq-api/actions/workflows/python-unittests.yml |
13 | 13 |
|
14 | | -intelmq-api is a `hug <http://hug.rest>`_ based API for the `intelmq <https://github.com/certtools/intelmq/>`_ project. |
| 14 | +.. |Package Status| image:: https://github.com/certtools/intelmq-api/actions/workflows/debian-package.yml/badge.svg |
| 15 | + :target: https://github.com/certtools/intelmq-api/actions/workflows/debian-package.yml |
| 16 | + |
| 17 | +intelmq-api is a `FastAPI <https://fastapi.tiangolo.com/>`_ based API for the `intelmq <https://github.com/certtools/intelmq/>`_ project. |
15 | 18 |
|
16 | 19 |
|
17 | 20 | Extensive documentation regarding the installation, configuration and usage of the `intelmq-api` can be found in the `intelmq documentation <https://intelmq.readthedocs.io/en/maintenance/user/intelmq-api.html>`_. |
18 | 21 |
|
| 22 | +***************** |
| 23 | +Development usage |
| 24 | +***************** |
| 25 | + |
| 26 | +You could create a preferred virtual environment, and then install the package using: |
| 27 | + |
| 28 | +.. code-block:: bash |
| 29 | +
|
| 30 | + pip install -e . |
| 31 | +
|
| 32 | +For development purposes, you can run the API using the `scripts/run_dev.sh` script. It serves the |
| 33 | +API on the local `8000` port and watches for file changes, with the automated reloading on change. |
| 34 | + |
| 35 | +The interactive documentation is served on the `/docs` endpoint. |
| 36 | + |
| 37 | +To set the API configuration, please export the `INTELMQ_API_CONFIG` environment variable with path |
| 38 | +to the JSON config file in the shell you want to use. For the config reference, please check the |
| 39 | +`intelmq_api/config.py` and the example from `contrib/api-config.json`. |
| 40 | + |
| 41 | +If you configured the session store, you will need to authorize every request. The `/v1/login` |
| 42 | +returns the authorization token. You can use the following command to register the user: |
| 43 | + |
| 44 | +.. code-block:: bash |
| 45 | +
|
| 46 | + ./scripts/intelmq-api-adduser --user UserName |
| 47 | +
|
| 48 | +************* |
| 49 | +Security note |
| 50 | +************* |
| 51 | + |
| 52 | +Please be careful when deploying the API. At the current stage, it is not designed to run on |
| 53 | +publicly exposed endpoints without additional pre-cautions. |
19 | 54 |
|
20 | 55 | ************* |
21 | 56 | Type checking |
22 | 57 | ************* |
23 | 58 |
|
24 | | -Except for the parts that directly deal with ``hug``, the code can be |
25 | | -typechecked with ``mypy``. To run the type checker, start with the module |
26 | | -``serve``: |
| 59 | +The code can be typechecked with ``mypy``. To run the type checker, use: |
27 | 60 |
|
28 | 61 | .. code-block:: bash |
29 | 62 |
|
30 | | - mypy intelmq_manager/serve.py |
| 63 | + mypy intelmq_api/ |
0 commit comments