zenx 0.9.4__tar.gz → 0.9.6__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.
- {zenx-0.9.4 → zenx-0.9.6}/PKG-INFO +1 -1
- {zenx-0.9.4 → zenx-0.9.6}/pyproject.toml +1 -1
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/discord.py +6 -2
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/PKG-INFO +1 -1
- {zenx-0.9.4 → zenx-0.9.6}/setup.cfg +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/cli.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/clients/__init__.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/clients/database.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/clients/http.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/debug_runner.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/discovery.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/engine.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/exceptions.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/logger.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/__init__.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/base.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/google_rpc.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/manager.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/preprocess.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/pipelines/websocket.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/resources/proto/__init__.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/resources/proto/feed_pb2.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/resources/proto/feed_pb2_grpc.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/settings.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/spiders/__init__.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/spiders/base.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx/utils.py +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/SOURCES.txt +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/dependency_links.txt +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/entry_points.txt +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/requires.txt +0 -0
- {zenx-0.9.4 → zenx-0.9.6}/zenx.egg-info/top_level.txt +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
from typing import Dict
|
2
|
+
import json
|
2
3
|
from structlog import BoundLogger
|
3
4
|
|
4
5
|
from zenx.pipelines.base import Pipeline
|
@@ -11,7 +12,7 @@ try:
|
|
11
12
|
from httpx import AsyncClient
|
12
13
|
|
13
14
|
class SynopticDiscordPipeline(Pipeline): # type: ignore[reportRedeclaration]
|
14
|
-
name = "
|
15
|
+
name = "synoptic_discord"
|
15
16
|
required_settings = ["SYNOPTIC_DISCORD_WEBHOOK"]
|
16
17
|
|
17
18
|
|
@@ -36,7 +37,9 @@ try:
|
|
36
37
|
async def _process(self, item: Dict) -> None:
|
37
38
|
try:
|
38
39
|
_item = {k: v for k, v in item.items() if not k.startswith("_")}
|
39
|
-
|
40
|
+
message_content = f"```json\n{json.dumps(_item, indent=4)}\n```"
|
41
|
+
payload = {"content": message_content}
|
42
|
+
await self._client.post(self._uri, json=payload)
|
40
43
|
except Exception as e:
|
41
44
|
self.logger.error("processing", exception=str(e), id=item.get("_id"), pipeline=self.name)
|
42
45
|
|
@@ -44,6 +47,7 @@ try:
|
|
44
47
|
async def close(self) -> None:
|
45
48
|
if hasattr(self, "_client") and self._client:
|
46
49
|
await self._client.aclose()
|
50
|
+
|
47
51
|
except ModuleNotFoundError:
|
48
52
|
# proxy pattern
|
49
53
|
class SynopticDiscordPipeline(Pipeline):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|