Skip to content

Commit 8b56d5b

Browse files
authored
Update README.md
1 parent ef04601 commit 8b56d5b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@ _First of all: provide some arguments in the `main.py` file to collect informati
1313

1414
To run the framework:
1515
```bash
16-
python3 main.py
16+
python3 main.py example_scenario.yaml
1717
```
1818
To run the tests:
1919
```bash
2020
chmod +x run_tests.sh
2121
./run_tests.sh
2222
```
23-
_or you can run them like this, of course:_
24-
```bash
25-
python3 -m unittest discover -v
26-
```
23+
2724
## Running as a separated module
2825
Basic:
2926
```python3
@@ -51,10 +48,11 @@ Use the following structure:
5148
2. Provide the following structure of your script directory:
5249
```
5350
your_script_name
54-
├── __init__.py - use this module to set the default parent directory (you can copy this file from any other script)
55-
├── __main__.py - use this module to provide some basic interface to use your script as a module (the same as if __name__ == "__main__")
56-
├── module.py - use this module to describe the basic logic of your module (you can import it in the __main__.py to provide interface)
57-
└── test_module.py - use this module for unittest tests
51+
├── requirements.txt - provide required libraries
52+
├── __init__.py - use this module to set the default parent directory (you can copy this file from any other script)
53+
├── __main__.py - use this module to provide some basic interface to use your script as a module (the same as if __name__ == "__main__")
54+
├── module.py - use this module to describe the basic logic of your module (you can import it in the __main__.py to provide interface)
55+
└── test_module.py - use this module for unittest tests
5856
```
5957
3. Create the `__init__.py` file. An example of the `__init__.py` boilerplate structure can be seen below:
6058
```python3
@@ -103,6 +101,9 @@ class Runner(OsintRunner):
103101
"""
104102
Basic script example
105103
"""
104+
105+
# Define required arguments here
106+
required = ["my_argument"]
106107

107108
def __init__(self, logger: str = __name__):
108109
"""
@@ -114,6 +115,7 @@ class Runner(OsintRunner):
114115
"""
115116
super(Runner, self).__init__(logger)
116117

118+
# Validate input arguments (if you need some validation)
117119
@validate_kwargs(PossibleKeys.KEYS)
118120
def run(self, *args, **kwargs) -> ScriptResponse.success or ScriptResponse.error:
119121
"""
@@ -126,6 +128,7 @@ class Runner(OsintRunner):
126128
:return: ScriptResponse message (error or success)
127129
"""
128130
argument = kwargs.get("my_argument", "Arguments were not provided!")
131+
...
129132
return ScriptResponse.success(message=f"Script finished with argument {argument}")
130133
```
131134
6. For `test_module.py` you can use any required tests (as you wish). A test case for your module is required to keep the project clean.

0 commit comments

Comments
 (0)