Shopping at LEGO or Amazon?
Please use our links: LEGO.comAmazon
As an Amazon Associate we earn from qualifying purchases.

Brickset API getSets call in Python

lin1eylin1ey Member Posts: 2
query = {'query': 'clone troopers'}

querystring = {'apiKey': secrets.API_KEY,
               'userHash': secrets.USER_HASH, 'params': query}

response = requests.request("GET", url, params=querystring)

This is the code I use in my python script. However, it returns 
{'status': 'error', 'message': 'Parameter error'}

instead of a success. This is very confusing because the other methods of the API return successfully and calling the API from the website test pages return successfully. This is the only method that I used with a "params" parameter, so I suspect it is related somehow but I am unsure.

Both checkKey and checkUserHash method return successful on both Python and page. What am I doing wrong?


  • lin1eylin1ey Member Posts: 2
    Update: I did json.dumps(query) and passed that as a param for params instead and it seemed to do the trick.
  • HuwHuw Administrator Posts: 7,087
    I'm glad you sussed it out because I have no idea how to actually use the API :-)
  • bluemondaybluemonday Member Posts: 1
    Hello, I came across this post as I've just started to look at using the API with Python. If it helps anyone else, the brickse library has been very easy for a new starter:
Sign In or Register to comment.

Shopping at or Amazon?

Please use our links: Amazon

Recent discussions Categories Privacy Policy

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started. is a participant in the Amazon Services LLC Associates Program, the, Inc. Associates Program and the Amazon EU Associates Programme, which are affiliate advertising programs designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.

As an Amazon Associate we earn from qualifying purchases.