[PyQt] headless browsing via PyQT4

Jiangcheng Bao jbao605 at gmail.com
Sun Feb 17 04:29:10 GMT 2013


Thank Kovid.

I tried that, it works. But it would not work if my terminal is under
unix screen program, which might not be a big deal if I launch via
cron.

I am also very interested in finding out if there's any way to
configure it to run really headless, without relying on xvfb even.

Thanks

On Sat, Feb 16, 2013 at 10:13 PM, Kovid Goyal <kovid at kovidgoyal.net> wrote:
> xvfb
>
> Kovid.
>
> On Sat, Feb 16, 2013 at 07:27:04PM -0500, Jiangcheng Bao wrote:
>> I am trying to achieve headless browsing via QWebView or QWebPage, but
>> looks like the application would require a X server to connect to,
>> even if I don't call the .show() method.
>>
>> The sample code at
>> http://webscraping.com/blog/Scraping-JavaScript-webpages-with-webkit/,
>> that does not call .show() method, but would fail with the following
>> error when running under terminal without DISPLAY set actually:
>>
>> cannot connect to X server
>>
>> I also tried to use module webkit.WebkitBrowser on
>> http://webscraping.com/, by creating WebkitBrowser and set gui=False
>> in the init method, but it also fails with the same error when there's
>> no DISPLAY.
>>
>> Anybody has some idea how do I actually achieve headless browsing, by
>> either subclass QWebView, or webkit.WebkitBrowser?
>>
>> Thanks
>> Jiangcheng Bao
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>> !DSPAM:3,512023f0281101428382049!
>>
>>
>
> --
> _____________________________________
>
> Dr. Kovid Goyal
> http://www.kovidgoyal.net
> http://calibre-ebook.com
> _____________________________________
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list