bhfutils 0.2.4__tar.gz → 0.2.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.
- {bhfutils-0.2.4 → bhfutils-0.2.6}/PKG-INFO +1 -1
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/pipelines.py +23 -6
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/settings_template.py +10 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/PKG-INFO +1 -1
- {bhfutils-0.2.4 → bhfutils-0.2.6}/setup.py +1 -1
- {bhfutils-0.2.4 → bhfutils-0.2.6}/MANIFEST.in +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/README.rst +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/bhf_signals.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/config/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/config/file_pusher.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/custom_cookies.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/distributed_scheduler.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/expire.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/items.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/log_retry_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/meta_passthrough_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_async/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_async/_mouse_helper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_async/_spoof.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_sync/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_sync/_mouse_helper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_sync/_spoof.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/js/mouseHelper.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/shared/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/shared/math.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/shared/spoof.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/handler.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/headers.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/chrome.app.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/chrome.csi.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/chrome.loadtimes.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/chrome.runtime.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/hairline.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/iframe.contentWindow.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/magic-arrays.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/media.codecs.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.deviceMemory.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.hardwareConcurrency.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.languages.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.permissions.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.platform.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.plugins.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.userAgent.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.vendor.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.webdriver.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/screen.touch.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/user-agent-override.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/utils.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/webgl.vendor.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/window.dimensions.js +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/page.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/stealth.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/policy.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/proxy_rotate.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/redis_domain_max_page_filter.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/redis_dupefilter.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/redis_global_page_per_domain_filter.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/redis_retry_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/redis_stats_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/spiders/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/spiders/redis_spider.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/online.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_distributed_scheduler.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_link_spider.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_log_retry_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_meta_passthrough_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_pipelines.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_redis_dupefilter.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_redis_page_limit_filters.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_redis_retry_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_redis_stats_middleware.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_wandering_spider.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_ah.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_lf.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_mt.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_rq.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_rtq.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_sc.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_sw.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/examples/example_zw.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/argparse_helper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/log_factory.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/method_timer.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/redis_queue.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/redis_throttled_queue.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/settings_wrapper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/stats_collector.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/scutils/zookeeper_watcher.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/__init__.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/default_settings.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/online.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/override_defaults.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_argparse_helper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_log_factory.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_method_timer.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_redis_queue.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_redis_throttled_queue.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_settings_wrapper.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_stats_collector.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/test_zookeeper_watcher.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/tests/throttled_queue.py +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/SOURCES.txt +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/dependency_links.txt +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/requires.txt +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/top_level.txt +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils.egg-info/zip-safe +0 -0
- {bhfutils-0.2.4 → bhfutils-0.2.6}/setup.cfg +0 -0
|
@@ -109,13 +109,30 @@ class KafkaPipeline(object):
|
|
|
109
109
|
bytes=my_bytes,
|
|
110
110
|
backups=my_backups)
|
|
111
111
|
|
|
112
|
+
# Security settings are optional: a spider running inside the VPC talks to the
|
|
113
|
+
# PLAINTEXT listener and defines none of them, while one running outside needs
|
|
114
|
+
# SASL_SSL. Defaults keep existing projects working without touching them.
|
|
115
|
+
producer_kwargs = dict(bootstrap_servers=settings['KAFKA_HOSTS'],
|
|
116
|
+
retries=3,
|
|
117
|
+
linger_ms=settings['KAFKA_PRODUCER_BATCH_LINGER_MS'],
|
|
118
|
+
buffer_memory=settings['KAFKA_PRODUCER_BUFFER_BYTES'],
|
|
119
|
+
value_serializer=lambda m: m.encode('utf-8'),
|
|
120
|
+
max_request_size=settings['KAFKA_PRODUCER_MAX_REQUEST_SIZE'])
|
|
121
|
+
|
|
122
|
+
security_protocol = settings.get('KAFKA_SECURITY_PROTOCOL', 'PLAINTEXT')
|
|
123
|
+
if security_protocol != 'PLAINTEXT':
|
|
124
|
+
producer_kwargs['security_protocol'] = security_protocol
|
|
125
|
+
if 'SASL' in security_protocol:
|
|
126
|
+
producer_kwargs['sasl_mechanism'] = settings.get('KAFKA_SASL_MECHANISM', 'PLAIN')
|
|
127
|
+
producer_kwargs['sasl_plain_username'] = settings.get('KAFKA_SASL_USERNAME')
|
|
128
|
+
producer_kwargs['sasl_plain_password'] = settings.get('KAFKA_SASL_PASSWORD')
|
|
129
|
+
if 'SSL' in security_protocol:
|
|
130
|
+
# Left as None for a certificate issued by a public CA: kafka-python then
|
|
131
|
+
# falls back to the system trust store. Set it only for a private CA.
|
|
132
|
+
producer_kwargs['ssl_cafile'] = settings.get('KAFKA_SSL_CAFILE')
|
|
133
|
+
|
|
112
134
|
try:
|
|
113
|
-
producer = KafkaProducer(
|
|
114
|
-
retries=3,
|
|
115
|
-
linger_ms=settings['KAFKA_PRODUCER_BATCH_LINGER_MS'],
|
|
116
|
-
buffer_memory=settings['KAFKA_PRODUCER_BUFFER_BYTES'],
|
|
117
|
-
value_serializer=lambda m: m.encode('utf-8'),
|
|
118
|
-
max_request_size=settings['KAFKA_PRODUCER_MAX_REQUEST_SIZE'])
|
|
135
|
+
producer = KafkaProducer(**producer_kwargs)
|
|
119
136
|
except Exception as e:
|
|
120
137
|
logger.error("Unable to connect to Kafka in Pipeline"", raising exit flag.")
|
|
121
138
|
# this is critical so we choose to exit.
|
|
@@ -22,6 +22,16 @@ KAFKA_PRODUCER_BATCH_LINGER_MS = 25 # 25 ms before flush
|
|
|
22
22
|
KAFKA_PRODUCER_BUFFER_BYTES = 4 * 1024 * 1024 # 4MB before blocking
|
|
23
23
|
KAFKA_PRODUCER_MAX_REQUEST_SIZE = 1024 * 1024 # 1MB
|
|
24
24
|
|
|
25
|
+
# Security for the Kafka connection. PLAINTEXT is right for a spider running inside
|
|
26
|
+
# the VPC, which reaches the broker's INTERNAL listener. A spider running anywhere
|
|
27
|
+
# else must go through the EXTERNAL listener and set SASL_SSL plus credentials.
|
|
28
|
+
KAFKA_SECURITY_PROTOCOL = 'PLAINTEXT'
|
|
29
|
+
KAFKA_SASL_MECHANISM = 'PLAIN'
|
|
30
|
+
KAFKA_SASL_USERNAME = None
|
|
31
|
+
KAFKA_SASL_PASSWORD = None
|
|
32
|
+
# Only needed for a certificate from a private CA; leave None for a public one.
|
|
33
|
+
KAFKA_SSL_CAFILE = None
|
|
34
|
+
|
|
25
35
|
ZOOKEEPER_ASSIGN_PATH = '/scrapy-cluster/crawler/'
|
|
26
36
|
ZOOKEEPER_ID = 'all'
|
|
27
37
|
ZOOKEEPER_HOSTS = 'localhost:2181'
|
|
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
|
{bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_async/_mouse_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/cursor/do_sync/_mouse_helper.py
RENAMED
|
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
|
{bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/playwright/js/navigator.hardwareConcurrency.js
RENAMED
|
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
|
|
File without changes
|
{bhfutils-0.2.4 → bhfutils-0.2.6}/bhfutils/crawler/tests/test_meta_passthrough_middleware.py
RENAMED
|
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
|
|
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
|