-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Local Execution Mode Without Service #32
Conversation
Now it can be run locally without a service.
scrapypuppeteer/middleware.py
Outdated
): | ||
self.service_base_url = service_url | ||
self.include_headers = include_headers | ||
class ServiceBrowserManager(BrowserManager): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to a seprate file.
setup.py
Outdated
|
||
setup( | ||
name="scrapy-puppeteer-client", | ||
version="0.3.2", | ||
version="0.3.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade version, not downgrade
scrapypuppeteer/middleware.py
Outdated
@@ -343,27 +199,19 @@ def from_crawler(cls, crawler: Crawler): | |||
) | |||
return cls(recaptcha_solving, submit_selectors) | |||
|
|||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad merge result?
scrapypuppeteer/browser_manager.py
Outdated
if puppeteer_request is None: | ||
return response | ||
|
||
if b"application/json" not in response.headers.get(b"Content-Type", b""): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code looks specific for process response in service browser manager
scrapypuppeteer/browser_manager.py
Outdated
|
||
|
||
|
||
class ServiceBrowserManager(BrowserManager): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split managers for diffrent files
@@ -72,18 +75,21 @@ def __init__( | |||
service_url: str, | |||
include_headers: Union[bool, List[str]], | |||
include_meta: bool, | |||
local_mode: bool, | |||
browser_manager: Union[ServiceBrowserManager, LocalBrowserManager] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not BrowserManager?
scrapypuppeteer/middleware.py
Outdated
): | ||
self.service_base_url = service_url | ||
self.include_headers = include_headers | ||
self.include_meta = include_meta | ||
self.crawler = crawler | ||
self.used_contexts = defaultdict(set) | ||
self.local_mode = local_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it used in middleware?
|
||
from abc import ABC, abstractmethod | ||
|
||
class BrowserManager(ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not in browser_managers init.py?
Title
Add Local Execution Mode Without Service
Description
This update introduces a new local execution mode for the application, allowing it to run without relying on the external service. To enable this mode, the following setting needs to be configured:
Enable local execution mode
Additionally, for local execution, it is necessary to install Chromium for Pyppeteer.
Type of change
This change does not affect existing functionalities.