Repository: apify/crawlee-python

Issue:
Can't configure Playwright crawler with Configuration
## Problem

I cannot overwrite the default settings of the BasicCrawler through the PlaywrightCrawler. Reason for this is that the [PlaywrightCrawler sets up its](https://github.com/apify/crawlee-python/blob/master/src/crawlee/crawlers/_playwright/_playwright_crawler.py#L151) `browser_pool = BrowserPool.with_default_plugin(..)` before calling `super().__init__()` which will set the configuration through the BasicCrawler's init, however the [browserpool code calls](https://github.com/apify/crawlee-python/blob/master/src/crawlee/browsers/_playwright_browser_plugin.py#L74) `service_locator.get_configuration()` which in turn locks setting the configuration preventing me from changing it. 

## Code
```python
from crawlee.configuration import Configuration
from crawlee.crawlers import PlaywrightCrawler

configuration = Configuration(default_dataset_id='my_dataset_id')
PlaywrightCrawler(configuration=configuration)
```

## Error message

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/crawlee-python/src/crawlee/crawlers/_playwright/_playwright_crawler.py", line 177, in __init__
    super().__init__(**kwargs)
  File "~/crawlee-python/src/crawlee/crawlers/_basic/_basic_crawler.py", line 310, in __init__
    service_locator.set_configuration(configuration)
  File "~/crawlee-python/src/crawlee/_service_locator.py", line 45, in set_configuration
    raise ServiceConflictError(Configuration, configuration, self._configuration)
crawlee.errors.ServiceConflictError: Service Configuration is already in use. Existing value: internal_timeout=None default_browser_path=None disable_browser_sandbox=False log_level='INFO' default_dataset_id='default' default_key_value_store_id='default' default_request_queue_id='default' purge_on_start=True write_metadata=True persist_storage=True persist_state_interval=datetime.timedelta(seconds=60) system_info_interval=datetime.timedelta(seconds=1) max_used_cpu_ratio=0.95 max_used_memory_ratio=0.9 max_event_loop_delay=datetime.timedelta(microseconds=50000) max_client_errors=1 memory_mbytes=None available_memory_ratio=0.25 storage_dir='./storage' headless=True, attempted new value: internal_timeout=None default_browser_path=None disable_browser_sandbox=False log_level='INFO' default_dataset_id='my_dataset_id' default_key_value_store_id='default' default_request_queue_id='default' purge_on_start=True write_metadata=True persist_storage=True persist_state_interval=datetime.timedelta(seconds=60) system_info_interval=datetime.timedelta(seconds=1) max_used_cpu_ratio=0.95 max_used_memory_ratio=0.9 max_event_loop_delay=datetime.timedelta(microseconds=50000) max_client_errors=1 memory_mbytes=None available_memory_ratio=0.25 storage_dir='./storage' headless=True.
```


Discussion:

Patch:
diff --git a/src/crawlee/crawlers/_playwright/_playwright_crawler.py b/src/crawlee/crawlers/_playwright/_playwright_crawler.py
index 946645b585..f07206e743 100644
--- a/src/crawlee/crawlers/_playwright/_playwright_crawler.py
+++ b/src/crawlee/crawlers/_playwright/_playwright_crawler.py
@@ -8,6 +8,7 @@
 from pydantic import ValidationError
 from typing_extensions import NotRequired, TypedDict, TypeVar
 
+from crawlee import service_locator
 from crawlee._request import Request, RequestOptions
 from crawlee._utils.blocked import RETRY_CSS_SELECTORS
 from crawlee._utils.docs import docs_group
@@ -120,6 +121,10 @@ def __init__(
                 This option should not be used if `browser_pool` is provided.
             kwargs: Additional keyword arguments to pass to the underlying `BasicCrawler`.
         """
+        configuration = kwargs.pop('configuration', None)
+        if configuration is not None:
+            service_locator.set_configuration(configuration)
+
         if browser_pool:
             # Raise an exception if browser_pool is provided together with other browser-related arguments.
             if any(


Test patch:
diff --git a/tests/unit/crawlers/_playwright/test_playwright_crawler.py b/tests/unit/crawlers/_playwright/test_playwright_crawler.py
index 1fde7920bf..5b7af71bf4 100644
--- a/tests/unit/crawlers/_playwright/test_playwright_crawler.py
+++ b/tests/unit/crawlers/_playwright/test_playwright_crawler.py
@@ -11,7 +11,8 @@
 
 import pytest
 
-from crawlee import ConcurrencySettings, HttpHeaders, Request, RequestTransformAction, SkippedReason
+from crawlee import ConcurrencySettings, HttpHeaders, Request, RequestTransformAction, SkippedReason, service_locator
+from crawlee.configuration import Configuration
 from crawlee.crawlers import PlaywrightCrawler
 from crawlee.fingerprint_suite import (
     DefaultFingerprintGenerator,
@@ -689,3 +690,11 @@ async def request_handler(context: PlaywrightCrawlingContext) -> None:
     assert check_data['send_request']['user-agent'] == 'My User-Agent'
 
     assert check_data['default'] != check_data['send_request']
+
+
+async def test_overwrite_configuration() -> None:
+    """Check that the configuration is allowed to be passed to the Playwrightcrawler."""
+    configuration = Configuration(default_dataset_id='my_dataset_id')
+    PlaywrightCrawler(configuration=configuration)
+    used_configuration = service_locator.get_configuration()
+    assert used_configuration is configuration