[PyQt] Last.fm call fails with QNetworkAccessManager

Doogster thedoogster at gmail.com
Sat Jan 7 22:09:45 GMT 2012


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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: last_fm_test.py
Type: text/x-python
Size: 1214 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120107/1643be32/attachment.py>


More information about the PyQt mailing list