[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] how to set accept-language
From: Peter Irbizon <peterirbizon () gmail ! com>
Date: 2014-05-22 10:39:07
Message-ID: CABFuWSz9o6i4LqpOHhuZU19L2Z_U67r5Y0Gtsm41f6FH3C1zTQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi Florian,
thank you for the right way!
2014-05-22 12:05 GMT+02:00 Florian Bruhin <me@the-compiler.org>:
> * Peter Irbizon <peterirbizon@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@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
[Attachment #5 (text/html)]
<div dir="ltr">Hi Florian, <div>thank you for the right way!<br></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">2014-05-22 12:05 GMT+02:00 \
Florian Bruhin <span dir="ltr"><<a href="mailto:me@the-compiler.org" \
target="_blank">me@the-compiler.org</a>></span>:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">* Peter Irbizon <<a \
href="mailto:peterirbizon@gmail.com">peterirbizon@gmail.com</a>> [2014-05-22 \
11:31:11 +0200]:<br>
<div class="">> Hi<br>
> I have this browser code and I am trying to put accept-language header. I<br>
> have no idea how to do it in this code. Can you help me what/where to add<br>
> it? Many thanks<br>
><br>
</div>> [...]<br>
<br>
You need to subclass QNetworkAccessManager to add the header,<br>
something like this:<br>
<br>
class NetworkManager(QNetworkAccessManager):<br>
def createRequest(self, op, req, outgoing_data):<br>
req.setRawHeader('Accept-Language'.encode('ascii'),<br>
\
'en-US,en'.encode('ascii'))<br> return super().createRequest(op, \
req, outgoing_data)<br> <br>
And then use setNetworkAccessManager() on your QWebPage.<br>
<span class="HOEnZb"><font color="#888888"><br>
Florian<br>
<br>
--<br>
() ascii ribbon campaign - stop html mail <a href="http://www.asciiribbon.org" \
target="_blank">www.asciiribbon.org</a><br> /\ <a href="http://www.the-compiler.org" \
target="_blank">www.the-compiler.org</a> | I love long mails <a \
href="http://email.is-not-s.ms/" target="_blank">http://email.is-not-s.ms/</a><br> No \
one can guarantee the actions of another. -- Spock, "Day of the Dove",<br> \
stardate unknown<br> \
</font></span><br>_______________________________________________<br> PyQt mailing \
list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic