Closed shivam-Purohit closed 5 months ago
Woops, you're right, I renamed the method a while ago and forgot to update the readme.
I'm a bit confused by what you mean with throwing circular import
because the two problems are:
await capture.prepare_context()
-> await capture.initialize_context()
max_depth_capture_time
when calling capture.capture_page
(which will be fixed because it is definitely not a useful requirement)The readme will be updated in a few min.
@Rafiot this is the error i am getting while i run the above code
Traceback (most recent call last):
File "/home/vboxuser/Desktop/honeynet project/captire/playwright.py", line 1, in <module>
from playwrightcapture import Capture
File "/home/vboxuser/.local/lib/python3.10/site-packages/playwrightcapture/__init__.py", line 1, in <module>
from .capture import Capture # noqa
File "/home/vboxuser/.local/lib/python3.10/site-packages/playwrightcapture/capture.py", line 29, in <module>
from playwright._impl._errors import TargetClosedError
File "/home/vboxuser/Desktop/honeynet project/captire/playwright.py", line 1, in <module>
from playwrightcapture import Capture
ImportError: cannot import name 'Capture' from partially initialized module 'playwrightcapture' (most likely due to a circular import) (/home/vboxuser/.local/lib/python3.10/site-packages/playwrightcapture/__init__.py)
Also is there any documentation i refer to, is there other customisation options like setting up a proxy or we just pass the url and get the results?
The circular import is due to the name of the file you're using (/home/vboxuser/Desktop/honeynet project/captire/playwright.py
). You cannot have a file called playwright.py
while the library imports playwright
.
The documentation of PlaywrightCapture itself is somewhat lacking, I have to admit. I'll work on that.
In the meantime, the documentation of LacusCore contains most of the settings you can pass to PlaywrightCapture: https://lacuscore.readthedocs.io/en/latest/api_reference.html#id4
And you can look at how it is used in this method: https://github.com/ail-project/LacusCore/blob/main/lacuscore/lacuscore.py#L458
oh my bad i didnt knew about that. Also thank you for the resources!
Depending on what you want to do, you may find using lookyloo easier. And there is a demo instance: https://lookyloo.circl.lu/
Its still under dicussion here
When i try to import the Capture. Its throwing circular import. I am using the same code given in the docs for testing