Jiaxin Lei
Jiaxin Lei

Reputation: 1

Using MLC API search function in Python

I am currently learning how to use the MLC API (website: https://public-api.themlc.com/api/doc), but I'm having difficulty with the search API. I want to search for artists' names or their works. Here's my current code:

headers = {
    'Authorization': f'Bearer {access_token}',
    'Content-Type': 'application/json'
}
works_query=[{"writerFirstName": "John", "writerLastName": "Doe"}]
get_works_url = 'https://public-api.themlc.com/search/songcode'
response = requests.post(get_works_url, headers=headers, json=works_query)

I have already obtained the access_token, but I'm receiving a 401 Unauthorized error. Could you please advise me on how to revise the code? Thank you!

I would like to receive help regarding how to revise the code.

Upvotes: 0

Views: 20

Answers (0)

Related Questions