graylog-api-client 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/PKG-INFO +1 -1
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/pyproject.toml +6 -1
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/data_structures.py +12 -0
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/graylog_api_client.py +19 -1
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/LICENSE +0 -0
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/README.md +0 -0
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/__init__.py +0 -0
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/exceptions.py +0 -0
- {graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/rest_adapter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "graylog-api-client"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "A Python wrapper for the Graylog REST API"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Chrxxxxs",email = "134285960+Chrxxxxs@users.noreply.github.com"}
|
|
@@ -22,3 +22,8 @@ packages = [{include = "graylog_api_client", from = "src"}]
|
|
|
22
22
|
[build-system]
|
|
23
23
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
24
24
|
build-backend = "poetry.core.masonry.api"
|
|
25
|
+
|
|
26
|
+
[dependency-groups]
|
|
27
|
+
dev = [
|
|
28
|
+
"pytest>=9.1.1",
|
|
29
|
+
]
|
{graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/data_structures.py
RENAMED
|
@@ -12,3 +12,15 @@ class GraylogApiResult:
|
|
|
12
12
|
self.status_code = int(status_code)
|
|
13
13
|
self.message = str(message)
|
|
14
14
|
self.data = data if data else []
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# TODO make this a proper class
|
|
18
|
+
class GraylogTimerange:
|
|
19
|
+
# Example relative:
|
|
20
|
+
# { "type": "relative", "range": 300 }
|
|
21
|
+
# Example absolute:
|
|
22
|
+
# { "type": "absolute", "from": "2023-01-01T00:00:00.000Z", "to": "2023-01-02T00:00:00.000Z" }
|
|
23
|
+
def relative(range: int):
|
|
24
|
+
...
|
|
25
|
+
def absolute(from_time: str, to_time: str):
|
|
26
|
+
...
|
{graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/graylog_api_client.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import List, Union, Dict
|
|
2
|
+
from typing import List, Literal, Union, Dict
|
|
3
3
|
|
|
4
4
|
from .rest_adapter import RestAdapter
|
|
5
5
|
from .data_structures import GraylogApiResult
|
|
@@ -84,6 +84,24 @@ class GraylogAPI:
|
|
|
84
84
|
# /roles
|
|
85
85
|
# /views/search Search
|
|
86
86
|
# /search Search Options (Decorators, Export, Functions etc.)
|
|
87
|
+
def post_search_query(self, query: str, start: int, timerange: dict, streams: list[str], stream_categories: list[str] = None,\
|
|
88
|
+
sort: str = None, sort_order: Literal["Ascending", "Descending"] = None,\
|
|
89
|
+
fields: list[str] = None, size: int = 50) -> GraylogApiResult:
|
|
90
|
+
"""start replaces the "from" parameter in the API"""
|
|
91
|
+
data = {
|
|
92
|
+
"query": query,
|
|
93
|
+
"from": str(start),
|
|
94
|
+
"timerange": timerange,
|
|
95
|
+
"streams": streams,
|
|
96
|
+
"stream_categories": stream_categories,
|
|
97
|
+
"sort": sort,
|
|
98
|
+
"sort_order": sort_order,
|
|
99
|
+
"fields": fields,
|
|
100
|
+
"size": str(size),
|
|
101
|
+
}
|
|
102
|
+
result = self._rest_adapter.post("search/messages", data=data)
|
|
103
|
+
return result
|
|
104
|
+
|
|
87
105
|
# /views/searchjobs Searchjobs
|
|
88
106
|
# /sidecars
|
|
89
107
|
# /sidecar
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graylog_api_client-0.1.2 → graylog_api_client-0.1.3}/src/graylog_api_client/rest_adapter.py
RENAMED
|
File without changes
|