[PyQt] how to set accept-language

Peter Irbizon peterirbizon at gmail.com
Thu May 22 11:39:07 BST 2014


Hi Florian,
thank you for the right way!


2014-05-22 12:05 GMT+02:00 Florian Bruhin <me at the-compiler.org>:

> * Peter Irbizon <peterirbizon at gmail.com> [2014-05-22 11:31:11 +0200]:
> > Hi
> > I have this browser code and I am trying to put accept-language header. I
> > have no idea how to do it in this code. Can you help me what/where to add
> > it? Many thanks
> >
> > [...]
>
> You need to subclass QNetworkAccessManager to add the header,
> something like this:
>
>     class NetworkManager(QNetworkAccessManager):
>         def createRequest(self, op, req, outgoing_data):
>             req.setRawHeader('Accept-Language'.encode('ascii'),
>                              'en-US,en'.encode('ascii'))
>             return super().createRequest(op, req, outgoing_data)
>
> And then use setNetworkAccessManager() on your QWebPage.
>
> Florian
>
> --
> () ascii ribbon campaign - stop html mail    www.asciiribbon.org
> /\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
> No one can guarantee the actions of another. -- Spock, "Day of the Dove",
> stardate unknown
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140522/cfb492fc/attachment.html>


More information about the PyQt mailing list