zenx 0.7.0__py3-none-any.whl → 0.7.2__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/pipelines/preprocess.py +2 -2
- zenx/utils.py +3 -2
- {zenx-0.7.0.dist-info → zenx-0.7.2.dist-info}/METADATA +1 -1
- {zenx-0.7.0.dist-info → zenx-0.7.2.dist-info}/RECORD +7 -7
- {zenx-0.7.0.dist-info → zenx-0.7.2.dist-info}/WHEEL +0 -0
- {zenx-0.7.0.dist-info → zenx-0.7.2.dist-info}/entry_points.txt +0 -0
- {zenx-0.7.0.dist-info → zenx-0.7.2.dist-info}/top_level.txt +0 -0
zenx/pipelines/preprocess.py
CHANGED
@@ -18,9 +18,9 @@ class PreprocessPipeline(Pipeline):
|
|
18
18
|
self.drop_if_scraped_too_late(item)
|
19
19
|
_id = item.get("_id")
|
20
20
|
if _id:
|
21
|
-
|
21
|
+
inserted = await self.db.insert(_id, spider)
|
22
|
+
if not inserted:
|
22
23
|
raise DropItem
|
23
|
-
await self.db.insert(_id, spider)
|
24
24
|
|
25
25
|
scraped_time = item['scraped_at'] - item['responded_at']
|
26
26
|
self.logger.info("scraped", id=item.get("_id"), time_ms=scraped_time, pipeline=self.name)
|
zenx/utils.py
CHANGED
@@ -13,8 +13,9 @@ def log_processing_time(func):
|
|
13
13
|
async def wrapper(self, item: Dict, spider: str, *args, **kwargs) -> Dict:
|
14
14
|
start_time = get_time()
|
15
15
|
result = await func(self, item, spider, *args, **kwargs)
|
16
|
-
|
17
|
-
|
16
|
+
end_time = get_time()
|
17
|
+
processed_time = end_time - start_time
|
18
|
+
self.logger.info("processed", id=item['_id'], time_ms=processed_time, pipeline=self.name, started_at=start_time, finished_at=end_time)
|
18
19
|
return result
|
19
20
|
return wrapper
|
20
21
|
|
@@ -5,7 +5,7 @@ zenx/engine.py,sha256=Nsz59CnHjUmlYa3dcqdRCBGZh8ZBHDht-rrZTKd1ysU,2341
|
|
5
5
|
zenx/exceptions.py,sha256=BJXxzwwX2CU6inhppfblx8c8Z6Mhvsk7MAhQ1LAnhBg,37
|
6
6
|
zenx/logger.py,sha256=UmEk0vV1mSCozV7z_DDgCCXdAManDr5wgkrhKiRQtyU,1651
|
7
7
|
zenx/settings.py,sha256=0RLeKcqHJdD1vuYIQtGeXkp2YIvv3tNyz9O8jw620VQ,1008
|
8
|
-
zenx/utils.py,sha256=
|
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=9QW2H-4vscoBKZy_iG_q8WvSExoD0U7Rih4FPsYngbI,4756
|
11
11
|
zenx/clients/http.py,sha256=fb6COYot6vidNFRBWgoU6CYEfnYWJP0JuVkydvxsHb4,5700
|
@@ -13,15 +13,15 @@ zenx/pipelines/__init__.py,sha256=IxkZ0UpEJdYjLdd-PMcC9PzzzArTBNNcpgKc7NiOe5Y,13
|
|
13
13
|
zenx/pipelines/base.py,sha256=N_388z5DFMeaU6wMwcClZAbQFWKh4kpAF7eUJhpQevs,1863
|
14
14
|
zenx/pipelines/google_rpc.py,sha256=F7p5ml9W1UliZbrDrF9MFNVKlCP5pG1WpO6rdmBgKp8,4707
|
15
15
|
zenx/pipelines/manager.py,sha256=bP2WIMblbWYHOJPU44l_IF3xLD0eHBYV4CCTFZc2FHI,1662
|
16
|
-
zenx/pipelines/preprocess.py,sha256=
|
16
|
+
zenx/pipelines/preprocess.py,sha256=4XoQDrz9jOI9Xu_v_HxNqu9jV5luSIOk-kvhv8eMQvE,764
|
17
17
|
zenx/pipelines/websocket.py,sha256=74XIV7_YbBngCgqKP3ZiBpDfQte-VB2G4kjNsZyycIc,4456
|
18
18
|
zenx/resources/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
zenx/resources/proto/feed_pb2.py,sha256=ZyICOLnyuXekkvV4bAHZ1nE1-wwzcYYRRrmRJCMrSoo,2810
|
20
20
|
zenx/resources/proto/feed_pb2_grpc.py,sha256=Mim6FfBgIMj0PmTqHk036nVUMJH3A6I3ts6r1j3bQF8,7441
|
21
21
|
zenx/spiders/__init__.py,sha256=rs5LuqdM2MQlUYiTGJrzkYhzN8_SSLTrR7wGjSRrrSo,25
|
22
22
|
zenx/spiders/base.py,sha256=YB-KqsAzfIUTzDMy5_ElgW1mul-I4Ltft6JAJxpy4hg,1672
|
23
|
-
zenx-0.7.
|
24
|
-
zenx-0.7.
|
25
|
-
zenx-0.7.
|
26
|
-
zenx-0.7.
|
27
|
-
zenx-0.7.
|
23
|
+
zenx-0.7.2.dist-info/METADATA,sha256=lPwP_syIdQ-4NhLaFRJB33joEYBln3bFyu6Hq9pa9SM,1273
|
24
|
+
zenx-0.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
25
|
+
zenx-0.7.2.dist-info/entry_points.txt,sha256=8JXob2f1VtvzGFris-e9Usqywg7oca-cChDlH9moOZU,38
|
26
|
+
zenx-0.7.2.dist-info/top_level.txt,sha256=JeXwvK86d7sB-2x-avugFnZIZa33zaHWKI8RHWJR6KY,5
|
27
|
+
zenx-0.7.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|