def testBook(): g = Goodreads() book, similar_books = g.getBook('50') print book.id, book.gid, book.author, book.list_shelves for shelve in book.list_shelves: print shelve.shelve, shelve.count, shelve.gid return
def testBook(): g=Goodreads() book, similar_books=g.getBook('50') print book.id, book.gid, book.author, book.list_shelves for shelve in book.list_shelves: print shelve.shelve, shelve.count, shelve.gid return
def testUserFriends(): c=Cassandra() g=Goodreads(new=False) user=models.Users(id=uuid4(), gid='3371638', name='Katie') friends, friendRelation, total=g.getFriends(user) if(friends is None): print "Private" else: print len(friends), len(friendRelation), total
def testUserFriends(): c = Cassandra() g = Goodreads(new=False) user = models.Users(id=uuid4(), gid='3371638', name='Katie') friends, friendRelation, total = g.getFriends(user) if (friends is None): print "Private" else: print len(friends), len(friendRelation), total
def retrieve_and_sort_books(languages=None, other=False, other_label='default', year=None, details=False): session = GoodreadsSession(api_key, api_secret) goodreads = Goodreads(session) goodreads.initialise_user() books = goodreads.get_books() arranger = BookArranger(books) sorted_books = arranger.sort_by_language(languages, other, other_label, year) arranger.print_sorted_books_nicely(sorted_books, details)
def retrieve_and_sort_books(languages=None, other=False, other_label='default', year=None, details=False, shelf='read'): session = GoodreadsSession(api_key, api_secret) goodreads = Goodreads(session) goodreads.initialise_user() books = goodreads.get_books(shelf) arranger = BookArranger(books) sorted_books = arranger.sort_by_language(languages, other, other_label, year) arranger.print_sorted_books_nicely(sorted_books, details)
def init(): initialize_logger(os.getcwd()) coloredlogs.install(level='DEBUG') coloredlogs.ColoredFormatter() c = Cassandra() syncTables() g = Goodreads() return (c, g)
def testUserReviews(c): #user=Users(id=uuid4(), gid='902976', name='Katie') #902976 katie, 1085121 Stephanie, 47225465 mio user = models.Users(id=uuid.uuid4(), gid=1085121, name='Simone', friends_count=1, small_user=True) u = c.get_user_if_exsists_or_save(user) reviewsDict, altready_retrieved = Goodreads().getUserReviews(u) if (altready_retrieved is False): c.saveUserReviews(u, reviewsDict) else: print "already retrieved"
import logging from goodreads import Goodreads from markdown_writer import write_book_to_md logging.basicConfig(filename="output.log", level=logging.INFO) if __name__ == "__main__": logging.info("/**********************START*************************/") books = Goodreads().retreive_books_from_shelf() for book in books: write_book_to_md(book) logging.info("/**********************COMPLETE*************************/")
def testUser(): Cassandra() sync_table(models.Users) g=Goodreads() u=g.getUser('4134243') u.save()
def testUser(): Cassandra() sync_table(models.Users) g = Goodreads() u = g.getUser('4134243') u.save()
def testBookReviews(): Goodreads().getBookReviews('0142437174')
print(f'wall: {time.time() - start}') f.write(f'wall: {time.time() - start}') if __name__ == '__main__': args = config() devices = list(map(int, args.gpu.split(','))) n_gpus = len(devices) # For GCMC based on sample, we require node has its own features. # Otherwise (node_id is the feature), the model can not scale dataset = Goodreads(args.data_name, 'cpu', mix_cpu_gpu=args.mix_cpu_gpu, use_one_hot_fea=args.use_one_hot_fea, symm=args.gcn_agg_norm_symm, test_ratio=args.data_test_ratio, valid_ratio=args.data_valid_ratio) print("Loading data finished ...\n") args.src_in_units = dataset.user_feature_shape[1] args.dst_in_units = dataset.item_feature_shape[1] args.rating_vals = dataset.possible_rating_values # cpu if devices[0] == -1: run(0, 0, args, ['cpu'], dataset) # gpu elif n_gpus == 1: run(0, n_gpus, args, devices, dataset)