first of all you need to install trello python library
pip install trellothen you need to have a text file including your book titles books.txt
save this script and put your API_KEY and TOKEN and LIST_ID
create a list and put .json in front of your url
for example:
https://trello.com/b/4GT6TNDDh/Tasks.json
and look for list id in json file
it should be look like this:
62f15c85XXXXXXXXX7a059ff
and i think you're good to go :)
from trello import TrelloApi
import requests
from bs4 import BeautifulSoup as bs
trello = TrelloApi('API_KEY', 'TOKEN')
def getHTMLdocument(url):
# request for HTML document of given url
response = requests.get(url)
# response will be provided in JSON format
return response.text
with open('books.txt', 'r') as books:
name = books.readlines()
for i in name:
url = f'https://www.goodreads.com/search?q={i}&qid=NHH3SBkK2v'
soup = bs(getHTMLdocument(url), 'html.parser')
author = soup.select('.authorName span')[0].get_text()
title = soup.select('.bookTitle span')[0].get_text()
trello.lists.new_card('LIST_ID', due='2022-02-02', name=title, desc=f"Author: {author}")
print(f"book {i} added!")