Search books function on public app doesnt work

Hi there, my deployed code fails to retrieve data, can someone help me?

This is the Code:

def search_books(q_keywords, q_lang_restrict):
api_key = ‘’
query = ’ '.join(q_keywords)
params = {
‘q’: query,
‘langRestrict’: q_lang_restrict,
‘key’: api_key
}
response = requests.get(‘https://www.googleapis.com/books/v1/volumes’, params=params)
if response.status_code != 200:
st.error(‘Failed to retrieve data’)
return
found_books = response.json().get(‘items’, )
return found_books

Hey @Asiba,

Thanks for sharing this question. Please update your post to properly format your code snippet (check out the instructions and full guidelines for posting in the forum here). Please also make sure that the code snippet you’re sharing is runnable.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.