Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-13 Thread David Boddie
On Wed May 11 22:41:13 BST 2011, Gelonida G wrote: def patch_agent(): old_userAgentForUrl = QWebPage.userAgentForUrl def new_userAgentForUrl(self, url): for demo purposes I just added logging rslt = old_userAgentForUrl(self, url) print agent is %s % rslt

Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-13 Thread David Boddie
On Fri May 13 02:23:30 BST 2011, Kay Hayen wrote: thanks in advance for any explanations or suggestions how to change the user agent 'globally' Why do you try to monkeypatch it? Subclassing QWebView and implementing just the overridden method is much cleaner and doesn't look like a

Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-12 Thread Detlev Offenbach
On Mittwoch, 11. Mai 2011, Gelonida G wrote: Hi, I would like to send a custom useragent for any http access done from a certain python script. So I assumed the way to go would be monkeypatching userAgentForUrl I'm not sure, whether this is impossible to achieve or whether I made a

Re: [PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-12 Thread Kay Hayen
Hello everybody, Somehow it seems, that the my patched method is never called. What could be the reason? thanks in advance for any explanations or suggestions how to change the user agent 'globally' Why do you try to monkeypatch it? Subclassing QWebView and implementing just the

[PyQt] Monkeypatching QWebPage.userAgentForUrl

2011-05-11 Thread Gelonida G
Hi, I would like to send a custom useragent for any http access done from a certain python script. So I assumed the way to go would be monkeypatching userAgentForUrl I'm not sure, whether this is impossible to achieve or whether I made a mistake in patching. This is my approach in my code