zenx 0.9.6__py3-none-any.whl → 0.9.8__py3-none-any.whl
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/clients/http.py +10 -6
- zenx/pipelines/google_rpc.py +4 -4
- zenx/settings.py +4 -5
- {zenx-0.9.6.dist-info → zenx-0.9.8.dist-info}/METADATA +2 -1
- {zenx-0.9.6.dist-info → zenx-0.9.8.dist-info}/RECORD +8 -8
- {zenx-0.9.6.dist-info → zenx-0.9.8.dist-info}/WHEEL +0 -0
- {zenx-0.9.6.dist-info → zenx-0.9.8.dist-info}/entry_points.txt +0 -0
- {zenx-0.9.6.dist-info → zenx-0.9.8.dist-info}/top_level.txt +0 -0
zenx/clients/http.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
import
|
2
|
+
from parsel import Selector, SelectorList
|
3
|
+
from functools import cached_property
|
3
4
|
import random
|
4
5
|
from curl_cffi.requests.impersonate import BrowserTypeLiteral
|
5
6
|
from curl_cffi import AsyncSession, Response as CurlResponse
|
@@ -7,7 +8,7 @@ from abc import ABC, abstractmethod
|
|
7
8
|
import asyncio
|
8
9
|
from dataclasses import dataclass
|
9
10
|
from typing import Any, ClassVar, Tuple, Type, Dict, get_args
|
10
|
-
import
|
11
|
+
import orjson
|
11
12
|
from structlog import BoundLogger
|
12
13
|
|
13
14
|
from zenx.settings import Settings
|
@@ -25,11 +26,14 @@ class Response:
|
|
25
26
|
latency_ms: int
|
26
27
|
|
27
28
|
def json(self) -> Any:
|
28
|
-
return
|
29
|
+
return orjson.loads(self.text)
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
return
|
31
|
+
@cached_property
|
32
|
+
def selector(self) -> Selector:
|
33
|
+
return Selector(self.text)
|
34
|
+
|
35
|
+
def xpath(self, query: str) -> SelectorList[Selector]:
|
36
|
+
return self.selector.xpath(query)
|
33
37
|
|
34
38
|
|
35
39
|
class HttpClient(ABC):
|
zenx/pipelines/google_rpc.py
CHANGED
@@ -15,14 +15,14 @@ try:
|
|
15
15
|
|
16
16
|
class SynopticGoogleRPCPipeline(Pipeline): # type: ignore[reportRedeclaration]
|
17
17
|
name = "synoptic_grpc"
|
18
|
-
required_settings = ["
|
18
|
+
required_settings = ["SYNOPTIC_GRPC_SERVER_URI", "SYNOPTIC_GRPC_TOKEN", "SYNOPTIC_GRPC_ID"]
|
19
19
|
|
20
20
|
|
21
21
|
def __init__(self, logger: structlog.BoundLogger, db: DBClient, settings: Settings) -> None:
|
22
22
|
super().__init__(logger, db, settings)
|
23
|
-
self._uri = self.settings.
|
24
|
-
self._feed_token = self.settings.
|
25
|
-
self._feed_id = self.settings.
|
23
|
+
self._uri = self.settings.SYNOPTIC_GRPC_SERVER_URI
|
24
|
+
self._feed_token = self.settings.SYNOPTIC_GRPC_TOKEN
|
25
|
+
self._feed_id = self.settings.SYNOPTIC_GRPC_ID
|
26
26
|
self._feed_pb2 = importlib.import_module("zenx.resources.proto.feed_pb2")
|
27
27
|
self._feed_pb2_grpc = importlib.import_module("zenx.resources.proto.feed_pb2_grpc")
|
28
28
|
|
zenx/settings.py
CHANGED
@@ -18,13 +18,12 @@ class Settings(BaseSettings):
|
|
18
18
|
DB_HOST: str | None = None
|
19
19
|
DB_PORT: int | None = None
|
20
20
|
|
21
|
-
|
21
|
+
PROXY_V4: str | None = None
|
22
22
|
PROXY_V6: str | None = None
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
GRPC_ID_HEADLINE: str | None = None
|
24
|
+
SYNOPTIC_GRPC_SERVER_URI: str = "ingress.opticfeeds.com"
|
25
|
+
SYNOPTIC_GRPC_TOKEN: str | None = None
|
26
|
+
SYNOPTIC_GRPC_ID: str | None = None
|
28
27
|
|
29
28
|
SYNOPTIC_DISCORD_WEBHOOK: str | None = None
|
30
29
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: zenx
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.8
|
4
4
|
Summary: mini-framework
|
5
5
|
Requires-Python: >=3.12
|
6
6
|
Requires-Dist: curl-cffi>=0.12.0
|
7
|
+
Requires-Dist: orjson>=3.11.0
|
7
8
|
Requires-Dist: parsel>=1.10.0
|
8
9
|
Requires-Dist: pebble>=5.1.1
|
9
10
|
Requires-Dist: pydantic>=2.11.7
|
@@ -4,15 +4,15 @@ zenx/discovery.py,sha256=YANVGzy2IG1fYruUud-11Y-ynyO6iEp3EjlHnhIQJQI,1014
|
|
4
4
|
zenx/engine.py,sha256=CYwvmPSaI1lC-y_DfuOzX_1Ii14fxU8IdfMM7AIrUUU,2551
|
5
5
|
zenx/exceptions.py,sha256=BJXxzwwX2CU6inhppfblx8c8Z6Mhvsk7MAhQ1LAnhBg,37
|
6
6
|
zenx/logger.py,sha256=lr45XGbV769NQcwn8-lAcPfFbR4yBN8LNh7o-i4Aa9M,1652
|
7
|
-
zenx/settings.py,sha256=
|
7
|
+
zenx/settings.py,sha256=anTT_jSQxwIabBHCM7egYFUOnALxp4fF_26_2ZPtTt4,1044
|
8
8
|
zenx/utils.py,sha256=wxild17cpO6SPLJ4dADuVj4IQehNjvOdafOCDPHnsIs,661
|
9
9
|
zenx/clients/__init__.py,sha256=CaAAuNa8DPyMdejR0KNSDDg_UzC3WxaTol5_QvwwwG8,132
|
10
10
|
zenx/clients/database.py,sha256=AF-L7iYrWRNzUZKn7taveiihpu--mXXC6eWOrMNlqzQ,4806
|
11
|
-
zenx/clients/http.py,sha256=
|
11
|
+
zenx/clients/http.py,sha256=wIxFC226JC0xm8gsBCDLjU2JzaJxXS08F_6jNHXK6ug,6417
|
12
12
|
zenx/pipelines/__init__.py,sha256=IxkZ0UpEJdYjLdd-PMcC9PzzzArTBNNcpgKc7NiOe5Y,131
|
13
13
|
zenx/pipelines/base.py,sha256=N_388z5DFMeaU6wMwcClZAbQFWKh4kpAF7eUJhpQevs,1863
|
14
14
|
zenx/pipelines/discord.py,sha256=4Ea52PzAViQZTVkwzvN9VxzjGVV_O4pMrqeOswtpkUo,2528
|
15
|
-
zenx/pipelines/google_rpc.py,sha256=
|
15
|
+
zenx/pipelines/google_rpc.py,sha256=mXFyY26ZiBjsp45YvaTfrN45cgfHmcn_tf0Rjzfnurw,4544
|
16
16
|
zenx/pipelines/manager.py,sha256=lm2A_4h8NNdurFfwrrLwx5Z1tqJ9yZp2qgYvwGWd1lc,2017
|
17
17
|
zenx/pipelines/preprocess.py,sha256=PTXDYo-B_T3YAY5AeUx5ExTDKZovQUwqmB8pyHo6i6o,958
|
18
18
|
zenx/pipelines/websocket.py,sha256=X4hwHAwFUXqmZ4aR6Aox0GHSxCUVjd1_7ZZeUQ2j-Lk,4865
|
@@ -21,8 +21,8 @@ zenx/resources/proto/feed_pb2.py,sha256=ZyICOLnyuXekkvV4bAHZ1nE1-wwzcYYRRrmRJCMr
|
|
21
21
|
zenx/resources/proto/feed_pb2_grpc.py,sha256=Mim6FfBgIMj0PmTqHk036nVUMJH3A6I3ts6r1j3bQF8,7441
|
22
22
|
zenx/spiders/__init__.py,sha256=rs5LuqdM2MQlUYiTGJrzkYhzN8_SSLTrR7wGjSRrrSo,25
|
23
23
|
zenx/spiders/base.py,sha256=MeZ3wZOPOyOX4V2ufFXtYGCDtXHZO_mNfnXdKMkisuQ,1951
|
24
|
-
zenx-0.9.
|
25
|
-
zenx-0.9.
|
26
|
-
zenx-0.9.
|
27
|
-
zenx-0.9.
|
28
|
-
zenx-0.9.
|
24
|
+
zenx-0.9.8.dist-info/METADATA,sha256=4mmQ8cjD-2cBDI-1wek_3O3MkEYeE0ZDzHSL-ea5nyw,1421
|
25
|
+
zenx-0.9.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
26
|
+
zenx-0.9.8.dist-info/entry_points.txt,sha256=8JXob2f1VtvzGFris-e9Usqywg7oca-cChDlH9moOZU,38
|
27
|
+
zenx-0.9.8.dist-info/top_level.txt,sha256=JeXwvK86d7sB-2x-avugFnZIZa33zaHWKI8RHWJR6KY,5
|
28
|
+
zenx-0.9.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|