[PyQt] Last.fm call fails with QNetworkAccessManager
Doogster
thedoogster at gmail.com
Sat Jan 7 22:34:27 GMT 2012
Of course, I figured it out just half an hour after giving up and
asking for help.
The problem was that the URL was percent-encoded, so I needed use
QUrl.fromEncoded(url_string) and not QUrl(url_string).
On Sat, Jan 7, 2012 at 2:09 PM, Doogster <thedoogster at gmail.com> wrote:
> Could you please tell me why a GET request to a last.fm web service
> URL returns a different result whether I call it from a browser or
> from a QNetworkAccessManager?
>
> A specific example would be the following URL:
>
> http://ws.audioscrobbler.com/2.0/?album=American+IV%3A+The+Man+Comes+Around&format=json&autocorrect=1&artist=Johnny+Cash&mbid=261de123-7315-4a2f-8c40-3dad9092313e&api_key=295a01cfa65f9e521bdd2cc3c36d7c89&method=album.getinfo
>
> Pasting it into Google Chrome's address bar produces the expected
> album info page.
>
> However, calling the same URL with a QNetworkRequest to a
> QNetworkAccessManager returns a response with the following body:
>
> {"error":6,"message":"Album not found"}
>
> Attached is a short program demonstrating this.
>
> Obviously, the program is not making the call correctly. How should I
> correct it?
More information about the PyQt
mailing list