batch_size = 50 query = 'food' scope = 'pins' # Obtain a list of boards we want to follow search_batch = pinterest.search(scope=scope, query=query, page_size=batch_size) while len(search_batch) > 0 and len(results) < max_results: for res in search_batch: if 'pinner' in res: results.append(res['pinner']) search_batch = pinterest.search(scope=scope, query=query, page_size=batch_size) return results boards = search_boards() # Follow boards for b in boards: print(b['url']) pinterest.follow_board(board_id=b['id']) # Instead of break you need a way to pause for some time in order to not get banned from pinterest. break users = search_users() for u in users: pinterest.follow_user(user_id=u['id']) # Instead of break you need a way to pause for some time in order to not get banned from pinterest. break
# Obtain a list of boards we want to follow search_batch = pinterest.search(scope=scope, query=query, page_size=batch_size) while len(search_batch) > 0 and len(results) < max_results: for res in search_batch: if 'pinner' in res: results.append(res['pinner']) search_batch = pinterest.search(scope=scope, query=query, page_size=batch_size) return results boards = search_boards() # Follow boards for b in boards: print(b['url']) pinterest.follow_board(board_id=b['id'], board_url=b['url']) # Instead of break you need a way to pause for some time in order to not get banned from pinterest. break users = search_users() for u in users: pinterest.follow_user(user_id=u['id'], username=u['username']) # Instead of break you need a way to pause for some time in order to not get banned from pinterest. break