Skip to content
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

Closed
wants to merge 11 commits into from
Closed

Conversation

AndrewKorzh
Copy link
Contributor

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

PUPPETEER_LOCAL = True

Additionally, for local execution, it is necessary to install Chromium for Pyppeteer.

Type of change

  • New feature

This change does not affect existing functionalities.

):
self.service_base_url = service_url
self.include_headers = include_headers
class ServiceBrowserManager(BrowserManager):
Copy link
Collaborator

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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade version, not downgrade

@@ -343,27 +199,19 @@ def from_crawler(cls, crawler: Crawler):
)
return cls(recaptcha_solving, submit_selectors)

@staticmethod
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad merge result?

if puppeteer_request is None:
return response

if b"application/json" not in response.headers.get(b"Content-Type", b""):
Copy link
Collaborator

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




class ServiceBrowserManager(BrowserManager):
Copy link
Collaborator

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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not BrowserManager?

):
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
Copy link
Collaborator

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):
Copy link
Collaborator

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?

@Yatskov Yatskov closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants