Skip to content

Readthedocs #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .ideconf/Build docs.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build docs" type="docs" factoryName="Sphinx task">
<module name="client-python" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="$PROJECT_DIR$/.venv/bin/python" />
<option name="SDK_NAME" value="Python 3.12 (client-python)" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="docutils_input_file" value="$PROJECT_DIR$/docs" />
<option name="docutils_output_file" value="$PROJECT_DIR$/docs/_build" />
<option name="docutils_params" value="" />
<option name="docutils_task" value="html" />
<option name="docutils_open_in_browser" value="false" />
<method v="2" />
</configuration>
</component>
28 changes: 28 additions & 0 deletions .ideconf/Serve web docs.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Serve web docs" type="PythonConfigurationType" factoryName="Python">
<module name="client-python" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Python 3.12 (client-python)" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/docs/_build" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="http.server" />
<option name="PARAMETERS" value="--bind 127.0.0.1 8090" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="true" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Build docs" run_configuration_type="docs" />
<option name="LaunchBrowser.Before.Run" url="http://localhost:8090" />
</method>
</configuration>
</component>
17 changes: 17 additions & 0 deletions .ideconf/Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tests" type="tests" factoryName="Autodetect">
<module name="client-python" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
</component>
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.PHONY: build
build:
SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=%ct) python3 -m build

.PHONY: clean
clean:
rm -rf *.egg-info/ build/ dist/

.PHONY: clean.all
clean.all: clean
find . -type d -name .mypy_cache -o -name __pycache__ -exec rm -rf "{}" \+
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ $ pip install -e .

### Client usage

To learn about how to use the OpenBAS Python client and read some examples and cases, refer to [the client documentation](https://openbas-client-for-python.readthedocs.io/en/latest/client_usage/getting_started.html).
To learn about how to use the OpenBAS Python client and read some examples and cases,
refer to [the client documentation](https://openbas-client-for-python.readthedocs.io/en/latest/client_usage/getting_started.html).

### API reference

To learn about the methods available for executing queries and retrieving their answers, refer to [the client API Reference](https://openbas-client-for-python.readthedocs.io/en/latest/pyobas/pyobas.html).
To learn about the methods available for executing queries and retrieving their answers,
refer to [the client API Reference](https://openbas-client-for-python.readthedocs.io/en/latest/pyobas/pyobas.html).

## Tests

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = "OpenBAS Project"

# The full version, including alpha/beta/rc tags
release = "1.10.1"
release = "1.12.2"

master_doc = "index"

Expand Down
61 changes: 48 additions & 13 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
=========================
OpenBAS client for Python
=========================

The pyobas library is designed to help OpenBAS users and developers to interact
with the OpenBAS platform API.
The PyOBAS library is designed to help OpenBAS users and developers to interact
with the OpenBAS platform API using Python. It requires Python 3.11 or above.

Quickstart
----------

Installation
************
`PyOBAS is available via PyPI <https://pypi.org/project/pyobas/>`_, so it may be installed with any good package manager.

Install with ``pip``:

.. code:: shell

pip install pyobas

Or with ``poetry``:

.. code:: shell

poetry add pyobas

Usage example
*************
As a demonstration, let's imagine we want to make a query for active users on a running OpenBAS server.

.. code:: python

from pyobas.client import OpenBAS;

def main():
# for example
url = "__OPENBAS_SERVER_URL__"
# find yours in your own profile on OpenBAS
token = "__API_TOKEN__"

The Python library requires Python >= 3.
client = OpenBAS(url, token)

.. toctree::
:maxdepth: 2
:caption: Contents:
users = client.user.list()

client_usage/getting_started.rst
pyobas/pyobas
for user in users:
print(user.user_email)

if __name__ == "__main__":
main()

Indices and tables
==================
Feature set
-----------
PyOBAS is not just an API client.

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* Interact with OpenBAS and query or modify its entities via a straightforward REST API
* Extend OpenBAS with custom Injectors, allowing for new capabilities
* Integrate with third-party security software suites to track the outcome of a simulated attack
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
autoapi==2.0.1
sphinx==7.4.7
sphinx==8.2.1
sphinx-autodoc-typehints==3.1.0
sphinx_rtd_theme==3.0.2